1 #ifndef RAPIDJSON_INTERNAL_META_H_
2 #define RAPIDJSON_INTERNAL_META_H_
8 template <
int N>
struct IntegralC {
enum {
Value = N }; };
9 template <
bool Cond>
struct BoolType : IntegralC<Cond> {};
10 struct TrueType : BoolType<true> {};
11 struct FalseType : BoolType<false> {};
13 template <
typename T>
struct AddConst {
typedef const T
Type; };
14 template <
typename T>
struct RemoveConst {
typedef T
Type; };
15 template <
typename T>
struct RemoveConst<const T> {
typedef T
Type; };
17 template <
bool Condition,
typename T1,
typename T2>
struct SelectIfCond;
18 template <
typename T1,
typename T2>
struct SelectIfCond<true,T1,T2> {
typedef T1
Type; };
19 template <
typename T1,
typename T2>
struct SelectIfCond<false,T1,T2> {
typedef T2
Type; };
21 template <
typename Condition,
typename T1,
typename T2>
22 struct SelectIf : SelectIfCond<Condition::Value,T1,T2> {};
24 template <
bool Constify,
typename T>
25 struct MaybeAddConst : SelectIfCond<Constify, const T, T> {};
27 template <
typename T,
typename U>
struct IsSame : FalseType {};
28 template <
typename T>
struct IsSame<T,T> : TrueType {};
30 template <
typename T>
struct IsConst : FalseType {};
31 template <
typename T>
struct IsConst<const T> : TrueType {};
33 template <
typename T>
struct IsPointer : FalseType {};
34 template <
typename T>
struct IsPointer<T*> : TrueType {};
36 template <
typename CT,
typename T>
40 && ( IsConst<CT>::Value >= IsConst<T>::Value ) )
44 template <
bool Condition,
typename T =
void>
struct EnableIfCond;
45 template <
typename T>
struct EnableIfCond<true, T> {
typedef T
Type; };
46 template <
typename T>
struct EnableIfCond<false, T> { };
48 template <
bool Condition,
typename T =
void>
49 struct DisableIfCond : EnableIfCond<!Condition, T> {};
51 template <
typename Condition,
typename T =
void>
52 struct EnableIf : EnableIfCond<Condition::Value, T> {};
54 template <
typename Condition,
typename T =
void>
55 struct DisableIf : DisableIfCond<Condition::Value, T> {};
58 struct SfinaeResultTag {};
59 template <
typename T>
struct RemoveSfinaeFptr {};
60 template <
typename T>
struct RemoveSfinaeFptr<SfinaeResultTag&(*)(T)> {
typedef T
Type; };
62 #define RAPIDJSON_REMOVEFPTR_(type) \
63 typename ::rapidjson::internal::RemoveSfinaeFptr \
64 < ::rapidjson::internal::SfinaeResultTag&(*) type>::Type
66 #define RAPIDJSON_ENABLEIF(cond) \
67 typename ::rapidjson::internal::EnableIf \
68 <RAPIDJSON_REMOVEFPTR_(cond)>::Type * = NULL
70 #define RAPIDJSON_DISABLEIF_RETURN(cond,returntype) \
71 typename ::rapidjson::internal::DisableIf<cond,returntype>::Type
77 #endif // RAPIDJSON_INTERNAL_META_H_
Type
Type of JSON value.
Definition: rapidjson.h:391
main RapidJSON namespace
Definition: allocators.h:6
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:1191