15 #ifndef WPIUTIL_WPI_POINTERLIKETYPETRAITS_H
16 #define WPIUTIL_WPI_POINTERLIKETYPETRAITS_H
20 #include <type_traits>
32 : std::integral_constant<size_t, ConstantLog2<N / 2>::value + 1> {};
33 template <>
struct ConstantLog2<1> : std::integral_constant<size_t, 0> {};
37 static const bool value =
false;
43 static const bool value =
true;
51 static const bool value =
true;
57 static inline void *getAsVoidPointer(T *P) {
return P; }
58 static inline T *getFromVoidPointer(
void *P) {
return static_cast<T *
>(P); }
64 static inline void *getAsVoidPointer(
void *P) {
return P; }
65 static inline void *getFromVoidPointer(
void *P) {
return P; }
74 enum { NumLowBitsAvailable = 2 };
81 static inline const void *getAsVoidPointer(
const T P) {
82 return NonConst::getAsVoidPointer(P);
84 static inline const T getFromVoidPointer(
const void *P) {
85 return NonConst::getFromVoidPointer(const_cast<void *>(P));
87 enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable };
94 static inline const void *getAsVoidPointer(
const T *P) {
95 return NonConst::getAsVoidPointer(const_cast<T *>(P));
97 static inline const T *getFromVoidPointer(
const void *P) {
98 return NonConst::getFromVoidPointer(const_cast<void *>(P));
100 enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable };
105 static inline void *getAsVoidPointer(uintptr_t P) {
106 return reinterpret_cast<void *
>(P);
108 static inline uintptr_t getFromVoidPointer(
void *P) {
109 return reinterpret_cast<uintptr_t
>(P);
112 enum { NumLowBitsAvailable = 0 };
Definition: PointerLikeTypeTraits.h:56
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
Definition: PointerLikeTypeTraits.h:26
WPILib C++ utilities (wpiutil) namespace.
Definition: SmallString.h:21
Definition: PointerLikeTypeTraits.h:36
Definition: PointerLikeTypeTraits.h:46
A tiny meta function to compute the log2 of a compile time constant.
Definition: PointerLikeTypeTraits.h:31