21 #ifndef RAPIDJSON_INTERNAL_META_H_
22 #define RAPIDJSON_INTERNAL_META_H_
26 RAPIDJSON_DIAG_OFF(effc++)
33 template <
int N>
struct IntegralC {
enum {
Value = N }; };
34 template <
bool Cond>
struct BoolType : IntegralC<Cond> {};
35 struct TrueType : BoolType<true> {};
36 struct FalseType : BoolType<false> {};
38 template <
typename T>
struct AddConst {
typedef const T
Type; };
39 template <
typename T>
struct RemoveConst {
typedef T
Type; };
40 template <
typename T>
struct RemoveConst<const T> {
typedef T
Type; };
42 template <
bool Condition,
typename T1,
typename T2>
struct SelectIfCond;
43 template <
typename T1,
typename T2>
struct SelectIfCond<true,T1,T2> {
typedef T1
Type; };
44 template <
typename T1,
typename T2>
struct SelectIfCond<false,T1,T2> {
typedef T2
Type; };
46 template <
typename Condition,
typename T1,
typename T2>
47 struct SelectIf : SelectIfCond<Condition::Value,T1,T2> {};
49 template <
bool Constify,
typename T>
50 struct MaybeAddConst : SelectIfCond<Constify, const T, T> {};
52 template <
typename T,
typename U>
struct IsSame : FalseType {};
53 template <
typename T>
struct IsSame<T,T> : TrueType {};
55 template <
typename T>
struct IsConst : FalseType {};
56 template <
typename T>
struct IsConst<const T> : TrueType {};
58 template <
typename T>
struct IsPointer : FalseType {};
59 template <
typename T>
struct IsPointer<T*> : TrueType {};
61 template <
typename CT,
typename T>
65 && ( IsConst<CT>::Value >= IsConst<T>::Value ) )
69 template <
bool Condition,
typename T =
void>
struct EnableIfCond;
70 template <
typename T>
struct EnableIfCond<true, T> {
typedef T
Type; };
71 template <
typename T>
struct EnableIfCond<false, T> { };
73 template <
bool Condition,
typename T =
void>
74 struct DisableIfCond : EnableIfCond<!Condition, T> {};
76 template <
typename Condition,
typename T =
void>
77 struct EnableIf : EnableIfCond<Condition::Value, T> {};
79 template <
typename Condition,
typename T =
void>
80 struct DisableIf : DisableIfCond<Condition::Value, T> {};
83 struct SfinaeResultTag {};
84 template <
typename T>
struct RemoveSfinaeFptr {};
85 template <
typename T>
struct RemoveSfinaeFptr<SfinaeResultTag&(*)(T)> {
typedef T
Type; };
87 #define RAPIDJSON_REMOVEFPTR_(type) \
88 typename ::rapidjson::internal::RemoveSfinaeFptr \
89 < ::rapidjson::internal::SfinaeResultTag&(*) type>::Type
91 #define RAPIDJSON_ENABLEIF(cond) \
92 typename ::rapidjson::internal::EnableIf \
93 <RAPIDJSON_REMOVEFPTR_(cond)>::Type * = NULL
95 #define RAPIDJSON_DISABLEIF_RETURN(cond,returntype) \
96 typename ::rapidjson::internal::DisableIf<cond,returntype>::Type
106 #endif // RAPIDJSON_INTERNAL_META_H_
Type
Type of JSON value.
Definition: rapidjson.h:420
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:1401