12 #ifndef ROOT_TypeTraits 13 #define ROOT_TypeTraits 16 #include <type_traits> 26 template <
typename... Types>
28 static constexpr std::size_t
list_size =
sizeof...(Types);
33 template <
typename T> constexpr
auto HasCallOp(
int ) -> decltype(&T::operator(),
true) {
return true; }
34 template <
typename T> constexpr
bool HasCallOp(
char ) {
return false; }
37 template <
typename T,
bool HasCallOp = ROOT::Detail::HasCallOp<T>(0)>
49 template <
typename R,
typename T,
typename... Args>
57 template <
typename R,
typename T,
typename... Args>
65 template <
typename R,
typename... Args>
73 template <
typename R,
typename... Args>
85 class IsSmartOrDumbPtr :
public std::integral_constant<bool, std::is_pointer<T>::value> {
101 template <
typename A>
102 static constexpr
bool Test(
A *
pt,
A const *cpt =
nullptr, decltype(pt->begin()) * =
nullptr,
103 decltype(pt->end()) * =
nullptr, decltype(cpt->begin()) * =
nullptr,
104 decltype(cpt->end()) * =
nullptr,
typename A::iterator *
pi =
nullptr,
105 typename A::const_iterator *pci =
nullptr)
107 using It_t =
typename A::iterator;
108 using CIt_t =
typename A::const_iterator;
109 using V_t =
typename A::value_type;
110 return std::is_same<Test_t, std::vector<bool>>::value ||
111 (std::is_same<decltype(pt->begin()), It_t>::value && std::is_same<decltype(pt->end()), It_t>::value &&
112 std::is_same<decltype(cpt->begin()), CIt_t>::value && std::is_same<decltype(cpt->end()), CIt_t>::value &&
113 std::is_same<decltype(**
pi), V_t &>::value && std::is_same<decltype(**pci), V_t const &>::value);
116 template <
typename A>
117 static constexpr
bool Test(...)
122 static constexpr
bool value = Test<Test_t>(
nullptr);
127 static constexpr
bool value =
true;
133 std::is_integral<T>::value &&
134 std::is_signed<T>::value &&
135 !std::is_same<T, char>::value
141 std::is_integral<T>::value &&
142 !std::is_signed<T>::value &&
143 !std::is_same<T, char>::value
158 template <
typename T,
typename... Rest>
163 template <
typename... Types>
168 template <
typename T,
typename... Rest>
173 template <
typename... Args>
180 template <
typename T>
185 template <
template <
typename...>
class Template,
typename T,
typename... Rest>
190 template <
typename T>
199 template <
typename T,
template <
typename...>
class U,
typename... Rest>
204 template <
typename T>
207 template <
typename T>
210 template <
typename V>
211 using Begin_t =
typename V::const_iterator (V::*)()
const;
213 template <
typename V>
214 using End_t =
typename V::const_iterator (V::*)()
const;
216 template <
typename V>
223 template <
typename V>
229 static constexpr
bool const value = Check<T>(0);
234 #endif // ROOT_TTypeTraits Remove first of possibly many template parameters.
typename RemoveFirstParameter< T >::type RemoveFirstParameter_t
ROOT::TypeTraits::TypeList< typename std::decay< Args >::type... > arg_types
constexpr bool HasCallOp(char)
static constexpr bool Check(...)
static constexpr double pi
Namespace for new ROOT classes and functions.
typename TakeFirstParameter< T >::type TakeFirstParameter_t
ROOT::TypeTraits::TypeList< Args... > arg_types_nodecay
typename V::const_iterator(V::*)() const End_t
typename CallableTraitsImpl< decltype(&T::operator())>::arg_types_nodecay arg_types_nodecay
#define R(a, b, c, d, e, f, g, h, i)
typename RemoveFirst< Args... >::type RemoveFirst_t
static constexpr std::size_t list_size
static constexpr auto Check(int) -> decltype(static_cast< Begin_t< V >>(&V::begin), static_cast< End_t< V >>(&V::end), true)
typename CallableTraitsImpl< decltype(&T::operator())>::arg_types arg_types
static constexpr bool Test(...)
std::is_floating_point< T > IsFloatNumeral
Checks for floating point types (that are not characters)
ROOT::TypeTraits::TypeList< typename std::decay< Args >::type... > arg_types
typename V::const_iterator(V::*)() const Begin_t
ROOT::TypeTraits::TypeList< Args... > arg_types_nodecay
static constexpr bool Test(A *pt, A const *cpt=nullptr, decltype(pt->begin()) *=nullptr, decltype(pt->end()) *=nullptr, decltype(cpt->begin()) *=nullptr, decltype(cpt->end()) *=nullptr, typename A::iterator *pi=nullptr, typename A::const_iterator *pci=nullptr)
ROOT::TypeTraits::TypeList< Args... > arg_types_nodecay
ROOT::TypeTraits::TypeList< typename std::decay< Args >::type... > arg_types
typename TakeFirstType< Types... >::type TakeFirstType_t
Lightweight storage for a collection of types.
ROOT::TypeTraits::TypeList< typename std::decay< Args >::type... > arg_types
Extract types from the signature of a callable object. See CallableTraits.
typedef void((*Func_t)())
typename std::decay< T >::type Test_t
ROOT::TypeTraits::TypeList< Args... > arg_types_nodecay
Check for container traits.
Checks for signed integers types that are not characters.
typename CallableTraitsImpl< decltype(&T::operator())>::ret_type ret_type
Checks for unsigned integer types that are not characters.
Return first of possibly many template parameters.