[libc-commits] [PATCH] D83980: [libc][NFC] Use RemoveCVType to implement IsIntegral.
Alex Brachet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Jul 16 15:55:45 PDT 2020
abrachet accepted this revision.
abrachet added inline comments.
This revision is now accepted and ready to land.
================
Comment at: libc/utils/CPP/TypeTraits.h:43
+template <typename Type> struct IsIntegral {
+ static constexpr bool Value =
----------------
Maybe we could have:
```lang=cpp
template <typename Type> struct IsIntegral {
using NoCV = RemoveCVType<Type>;
static constexpr bool Value = IsSame<char, NoCV>::Value ||
...
```
It also might make sense to make an `std::is_same_v` so we don't need to keep adding `::Value`
================
Comment at: libc/utils/CPP/TypeTraits.h:59-60
+
+template <typename T> struct IsPointerType : public FalseValue {};
+template <typename T> struct IsPointerType<T *> : public TrueValue {};
+
----------------
This needs RemoveCV too. As a nit, this and the `IsFloatingPointType` shouldn't have Type at the end because that sounds like it would be analogous to the type definitions which end in `_t` like `std::remove_cv_t`. Although these templates have a `Value` not `Type` I think it is still better to leave it off. Especially because the `type_traits` version of these are just be called `std::is_pointer` and `std::is_floating_point`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83980/new/
https://reviews.llvm.org/D83980
More information about the libc-commits
mailing list