15#ifndef RAPIDJSON_INTERNAL_META_H_
16#define RAPIDJSON_INTERNAL_META_H_
22RAPIDJSON_DIAG_OFF(effc++)
25#if defined(_MSC_VER) && !defined(__clang__)
27RAPIDJSON_DIAG_OFF(6334)
30#if RAPIDJSON_HAS_CXX11_TYPETRAITS
51 static const bool Value = Cond;
52 typedef BoolType
Type;
54typedef BoolType<true> TrueType;
55typedef BoolType<false> FalseType;
64 template <
typename T1,
typename T2>
71struct SelectIfImpl<false>
73 template <
typename T1,
typename T2>
79template <
bool C,
typename T1,
typename T2>
80struct SelectIfCond : SelectIfImpl<C>::template Apply<T1, T2>
83template <
typename C,
typename T1,
typename T2>
84struct SelectIf : SelectIfCond<C::Value, T1, T2>
88template <
bool Cond1,
bool Cond2>
89struct AndExprCond : FalseType
93struct AndExprCond<true, true> : TrueType
96template <
bool Cond1,
bool Cond2>
97struct OrExprCond : TrueType
101struct OrExprCond<false, false> : FalseType
106struct BoolExpr : SelectIf<C, TrueType, FalseType>
::Type
110struct NotExpr : SelectIf<C, FalseType, TrueType>
::Type
113template <
typename C1,
typename C2>
114struct AndExpr : AndExprCond<C1::Value, C2::Value>
::Type
117template <
typename C1,
typename C2>
118struct OrExpr : OrExprCond<C1::Value, C2::Value>
::Type
127 typedef const T
Type;
129template <
bool Constify,
typename T>
130struct MaybeAddConst : SelectIfCond<Constify, const T, T>
139struct RemoveConst<const T>
147template <
typename T,
typename U>
148struct IsSame : FalseType
152struct IsSame<T, T> : TrueType
157struct IsConst : FalseType
161struct IsConst<const T> : TrueType
165template <
typename CT,
typename T>
166struct IsMoreConst : AndExpr<IsSame<typename RemoveConst<CT>::Type, typename RemoveConst<T>::Type>,
167 BoolType<IsConst<CT>::Value >= IsConst<T>::Value>>
::Type
172struct IsPointer : FalseType
176struct IsPointer<T*> : TrueType
183#if RAPIDJSON_HAS_CXX11_TYPETRAITS
185template <
typename B,
typename D>
186struct IsBaseOf : BoolType<::std::is_base_of<B, D>::value>
192template <
typename B,
typename D>
198 typedef char (&Yes)[1];
199 typedef char (&No)[2];
201 template <
typename T>
202 static Yes Check(
const D*, T);
203 static No Check(
const B*,
int);
207 operator const B*()
const;
213 Value = (
sizeof(Check(Host(), 0)) ==
sizeof(Yes))
217template <
typename B,
typename D>
218struct IsBaseOf : OrExpr<IsSame<B, D>, BoolExpr<IsBaseOfImpl<B, D>>>
::Type
227template <
bool Condition,
typename T =
void>
233struct EnableIfCond<false, T>
237template <
bool Condition,
typename T =
void>
243struct DisableIfCond<true, T>
247template <
typename Condition,
typename T =
void>
248struct EnableIf : EnableIfCond<Condition::Value, T>
252template <
typename Condition,
typename T =
void>
253struct DisableIf : DisableIfCond<Condition::Value, T>
262struct RemoveSfinaeTag;
264struct RemoveSfinaeTag<SfinaeTag& (*)(T)>
269#define RAPIDJSON_REMOVEFPTR_(type) \
270 typename ::RAPIDJSON_NAMESPACE::internal::RemoveSfinaeTag< \
271 ::RAPIDJSON_NAMESPACE::internal::SfinaeTag&(*)type>::Type
273#define RAPIDJSON_ENABLEIF(cond) \
274 typename ::RAPIDJSON_NAMESPACE::internal::EnableIf<RAPIDJSON_REMOVEFPTR_(cond)>::Type* = NULL
276#define RAPIDJSON_DISABLEIF(cond) \
277 typename ::RAPIDJSON_NAMESPACE::internal::DisableIf<RAPIDJSON_REMOVEFPTR_(cond)>::Type* = NULL
279#define RAPIDJSON_ENABLEIF_RETURN(cond, returntype) \
280 typename ::RAPIDJSON_NAMESPACE::internal::EnableIf<RAPIDJSON_REMOVEFPTR_(cond), \
281 RAPIDJSON_REMOVEFPTR_(returntype)>::Type
283#define RAPIDJSON_DISABLEIF_RETURN(cond, returntype) \
284 typename ::RAPIDJSON_NAMESPACE::internal::DisableIf<RAPIDJSON_REMOVEFPTR_(cond), \
285 RAPIDJSON_REMOVEFPTR_(returntype)>::Type
291#if defined(_MSC_VER) && !defined(__clang__)
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition document.h:3124
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition rapidjson.h:121
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition rapidjson.h:124
Definition allocators.h:459
common definitions and configuration
Type
Type of JSON value.
Definition rapidjson.h:760
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition rapidjson.h:500