12#ifndef ROOT_TypeTraits
13#define ROOT_TypeTraits
26template <
typename... Types>
28 static constexpr std::size_t
list_size =
sizeof...(Types);
33template <
typename T>
constexpr auto HasCallOp(
int ) ->
decltype(&T::operator(),
true) {
return true; }
34template <
typename T>
constexpr bool HasCallOp(
char ) {
return false; }
37template <typename T, bool HasCallOp = ROOT::Detail::HasCallOp<T>(0)>
49template <
typename R,
typename T,
typename... Args>
57template <
typename R,
typename T,
typename... Args>
65template <
typename R,
typename... Args>
73template <
typename R,
typename... Args>
85class IsSmartOrDumbPtr :
public std::integral_constant<bool, std::is_pointer<T>::value> {
93class IsSmartOrDumbPtr<std::unique_ptr<P>> :
public std::true_type {
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
158template <
typename T,
typename... Rest>
163template <
typename... Types>
168template <
typename T,
typename... Rest>
173template <
typename... Args>
185template <
template <
typename...>
class Template,
typename T,
typename... Rest>
199template <
typename T,
template <
typename...>
class U,
typename... Rest>
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);
#define R(a, b, c, d, e, f, g, h, i)
typedef void((*Func_t)())
typename TakeFirstParameter< T >::type TakeFirstParameter_t
typename RemoveFirst< Args... >::type RemoveFirst_t
std::is_floating_point< T > IsFloatNumeral
Checks for floating point types (that are not characters)
typename TakeFirstType< Types... >::type TakeFirstType_t
typename RemoveFirstParameter< T >::type RemoveFirstParameter_t
constexpr auto HasCallOp(int) -> decltype(&T::operator(), true)
static constexpr double pi
typename CallableTraitsImpl< decltype(&T::operator())>::arg_types arg_types
typename CallableTraitsImpl< decltype(&T::operator())>::arg_types_nodecay arg_types_nodecay
typename CallableTraitsImpl< decltype(&T::operator())>::ret_type ret_type
Extract types from the signature of a callable object. See CallableTraits.
typename V::const_iterator(V::*)() const Begin_t
static constexpr bool Check(...)
static constexpr auto Check(int) -> decltype(static_cast< Begin_t< V > >(&V::begin), static_cast< End_t< V > >(&V::end), true)
typename V::const_iterator(V::*)() const End_t
static constexpr bool const value
Check for container traits.
typename std::decay< T >::type Test_t
static constexpr bool Test(...)
static constexpr bool value
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)
Checks for signed integers types that are not characters.
Checks for unsigned integer types that are not characters.
Remove first of possibly many template parameters.
Return first of possibly many template parameters.
Lightweight storage for a collection of types.
static constexpr std::size_t list_size