29 #ifndef AURORA_TEMPLATES_HPP
30 #define AURORA_TEMPLATES_HPP
34 #include <type_traits>
43 template <std::
size_t N,
typename T0,
typename T1,
typename T2>
46 template <
typename T0,
typename T1,
typename T2>
47 struct NthType<0, T0, T1, T2>
52 template <
typename T0,
typename T1,
typename T2>
53 struct NthType<1, T0, T1, T2>
58 template <
typename T0,
typename T1,
typename T2>
59 struct NthType<2, T0, T1, T2>
66 template <
typename R, std::
size_t N,
typename P0,
typename P1,
typename P2>
67 struct FunctionSignatureBase
70 static const std::size_t arity = N;
72 template <std::
size_t M>
75 typedef typename NthType<M, P0, P1, P2>::Type Type;
89 struct FunctionSignature;
92 struct FunctionSignature<R()> : FunctionSignatureBase<R, 0, EmptyType, EmptyType, EmptyType>
96 template <
typename R,
typename P0>
97 struct FunctionSignature<R(P0)> : FunctionSignatureBase<R, 1, P0, EmptyType, EmptyType>
101 template <
typename R,
typename P0,
typename P1>
102 struct FunctionSignature<R(P0, P1)> : FunctionSignatureBase<R, 2, P0, P1, EmptyType>
106 template <
typename R,
typename P0,
typename P1,
typename P2>
107 struct FunctionSignature<R(P0, P1, P2)> : FunctionSignatureBase<R, 3, P0, P1, P2>
119 template <
typename T>
130 static const int value = N;
138 template <
typename Signature>
141 typedef typename detail::FunctionSignature<Signature>::ResultType Type;
149 template <
typename Signature, std::
size_t N>
152 typedef typename detail::FunctionSignature<Signature>::template Param<N>::Type Type;
160 template <
typename Signature>
163 static const std::size_t value = detail::FunctionSignature<Signature>::arity;
174 #define AURORA_ENABLE_IF(...) , typename std::enable_if<__VA_ARGS__>::type* = nullptr
177 #if defined(AURORA_DOXYGEN_SECTION)
190 #define AURORA_REQUIRE_COMPLETE_TYPE(Type) ImplementationDefined
192 #elif defined(__GNUC__) || defined(__clang__)
195 #define AURORA_REQUIRE_COMPLETE_TYPE(Type) typedef char auroraRequireCompleteType[(sizeof(Type))] __attribute__((unused))
199 #define AURORA_REQUIRE_COMPLETE_TYPE(Type) typedef char auroraRequireCompleteType[(sizeof(Type))]
212 #define AURORA_AUTO_RETURN(...) decltype(__VA_ARGS__) { return (__VA_ARGS__); }
224 template <
typename T>
225 struct RemoveIndirection
227 typedef typename std::remove_pointer<
228 typename std::remove_reference<T>::type
234 template <
typename T>
237 typedef typename std::remove_const<
238 typename RemoveIndirection<T>::type
244 template <
typename Origin,
typename New>
247 typedef typename RawType<New>::type raw;
249 typedef typename std::conditional<
250 std::is_const<typename RemoveIndirection<Origin>::type>::value,
252 raw>::type c_qualified;
254 typedef typename std::conditional<std::is_pointer<Origin>::value, c_qualified*, c_qualified>::type cp_qualified;
255 typedef typename std::conditional<std::is_reference<Origin>::value, cp_qualified&, cp_qualified>::type cpr_qualified;
256 typedef typename std::conditional<std::is_const<Origin>::value,
const cpr_qualified, cpr_qualified>::type type;
260 #define AURORA_REPLICATE(Origin, New) typename aurora::detail::Replicate<Origin, New>::type
265 #endif // AURORA_TEMPLATES_HPP
Simple type wrapper, can be used for overload resolution.
Definition: Templates.hpp:120
Configuration header of the library.
Simple integer wrapper, can be used for overload resolution.
Definition: Templates.hpp:128
Find out the N-th parameter type of a function.
Definition: Templates.hpp:150
Find out the return type of a function.
Definition: Templates.hpp:139
Find out the number of parameters of a function.
Definition: Templates.hpp:161
Definition: DispatchTraits.hpp:39