use detected instead of has_* traits
This commit is contained in:
parent
1ea8cd128c
commit
b59c3367c9
4 changed files with 157 additions and 178 deletions
|
@ -102,22 +102,3 @@
|
|||
basic_json<ObjectType, ArrayType, StringType, BooleanType, \
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, \
|
||||
AllocatorType, JSONSerializer>
|
||||
|
||||
/*!
|
||||
@brief Helper to determine whether there's a key_type for T.
|
||||
|
||||
This helper is used to tell associative containers apart from other containers
|
||||
such as sequence containers. For instance, `std::map` passes the test as it
|
||||
contains a `mapped_type`, whereas `std::vector` fails the test.
|
||||
|
||||
@sa http://stackoverflow.com/a/7728728/266378
|
||||
@since version 1.0.0, overworked in version 2.0.6
|
||||
*/
|
||||
#define NLOHMANN_JSON_HAS_HELPER(type) \
|
||||
template<typename T> struct has_##type { \
|
||||
template<typename U, typename = typename U::type> \
|
||||
static int detect(U &&); \
|
||||
static void detect(...); \
|
||||
static constexpr bool value = \
|
||||
std::is_integral<decltype(detect(std::declval<T>()))>::value; \
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue