🚨 fixed a compiler warning #1224
This commit is contained in:
parent
d713727f22
commit
eb30ff0615
4 changed files with 4 additions and 17 deletions
5
Makefile
5
Makefile
|
@ -191,7 +191,10 @@ pedantic_gcc:
|
||||||
-Wunused-macros \
|
-Wunused-macros \
|
||||||
-Wunused-parameter \
|
-Wunused-parameter \
|
||||||
-Wuseless-cast \
|
-Wuseless-cast \
|
||||||
-Wvariadic-macros"
|
-Wvariadic-macros \
|
||||||
|
-Wctor-dtor-privacy \
|
||||||
|
-Winit-self \
|
||||||
|
-Wstrict-null-sentinel"
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# benchmarks
|
# benchmarks
|
||||||
|
|
|
@ -115,11 +115,9 @@ contains a `mapped_type`, whereas `std::vector` fails the test.
|
||||||
*/
|
*/
|
||||||
#define NLOHMANN_JSON_HAS_HELPER(type) \
|
#define NLOHMANN_JSON_HAS_HELPER(type) \
|
||||||
template<typename T> struct has_##type { \
|
template<typename T> struct has_##type { \
|
||||||
private: \
|
|
||||||
template<typename U, typename = typename U::type> \
|
template<typename U, typename = typename U::type> \
|
||||||
static int detect(U &&); \
|
static int detect(U &&); \
|
||||||
static void detect(...); \
|
static void detect(...); \
|
||||||
public: \
|
|
||||||
static constexpr bool value = \
|
static constexpr bool value = \
|
||||||
std::is_integral<decltype(detect(std::declval<T>()))>::value; \
|
std::is_integral<decltype(detect(std::declval<T>()))>::value; \
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,14 +141,12 @@ struct is_compatible_integer_type
|
||||||
template<typename BasicJsonType, typename T>
|
template<typename BasicJsonType, typename T>
|
||||||
struct has_from_json
|
struct has_from_json
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
// also check the return type of from_json
|
// also check the return type of from_json
|
||||||
template<typename U, typename = enable_if_t<std::is_same<void, decltype(uncvref_t<U>::from_json(
|
template<typename U, typename = enable_if_t<std::is_same<void, decltype(uncvref_t<U>::from_json(
|
||||||
std::declval<BasicJsonType>(), std::declval<T&>()))>::value>>
|
std::declval<BasicJsonType>(), std::declval<T&>()))>::value>>
|
||||||
static int detect(U&&);
|
static int detect(U&&);
|
||||||
static void detect(...);
|
static void detect(...);
|
||||||
|
|
||||||
public:
|
|
||||||
static constexpr bool value = std::is_integral<decltype(
|
static constexpr bool value = std::is_integral<decltype(
|
||||||
detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
||||||
};
|
};
|
||||||
|
@ -158,7 +156,6 @@ struct has_from_json
|
||||||
template<typename BasicJsonType, typename T>
|
template<typename BasicJsonType, typename T>
|
||||||
struct has_non_default_from_json
|
struct has_non_default_from_json
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
template <
|
template <
|
||||||
typename U,
|
typename U,
|
||||||
typename = enable_if_t<std::is_same<
|
typename = enable_if_t<std::is_same<
|
||||||
|
@ -166,7 +163,6 @@ struct has_non_default_from_json
|
||||||
static int detect(U&&);
|
static int detect(U&&);
|
||||||
static void detect(...);
|
static void detect(...);
|
||||||
|
|
||||||
public:
|
|
||||||
static constexpr bool value = std::is_integral<decltype(detect(
|
static constexpr bool value = std::is_integral<decltype(detect(
|
||||||
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
||||||
};
|
};
|
||||||
|
@ -175,13 +171,11 @@ struct has_non_default_from_json
|
||||||
template<typename BasicJsonType, typename T>
|
template<typename BasicJsonType, typename T>
|
||||||
struct has_to_json
|
struct has_to_json
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
template<typename U, typename = decltype(uncvref_t<U>::to_json(
|
template<typename U, typename = decltype(uncvref_t<U>::to_json(
|
||||||
std::declval<BasicJsonType&>(), std::declval<T>()))>
|
std::declval<BasicJsonType&>(), std::declval<T>()))>
|
||||||
static int detect(U&&);
|
static int detect(U&&);
|
||||||
static void detect(...);
|
static void detect(...);
|
||||||
|
|
||||||
public:
|
|
||||||
static constexpr bool value = std::is_integral<decltype(detect(
|
static constexpr bool value = std::is_integral<decltype(detect(
|
||||||
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
||||||
};
|
};
|
||||||
|
|
|
@ -230,11 +230,9 @@ contains a `mapped_type`, whereas `std::vector` fails the test.
|
||||||
*/
|
*/
|
||||||
#define NLOHMANN_JSON_HAS_HELPER(type) \
|
#define NLOHMANN_JSON_HAS_HELPER(type) \
|
||||||
template<typename T> struct has_##type { \
|
template<typename T> struct has_##type { \
|
||||||
private: \
|
|
||||||
template<typename U, typename = typename U::type> \
|
template<typename U, typename = typename U::type> \
|
||||||
static int detect(U &&); \
|
static int detect(U &&); \
|
||||||
static void detect(...); \
|
static void detect(...); \
|
||||||
public: \
|
|
||||||
static constexpr bool value = \
|
static constexpr bool value = \
|
||||||
std::is_integral<decltype(detect(std::declval<T>()))>::value; \
|
std::is_integral<decltype(detect(std::declval<T>()))>::value; \
|
||||||
}
|
}
|
||||||
|
@ -471,14 +469,12 @@ struct is_compatible_integer_type
|
||||||
template<typename BasicJsonType, typename T>
|
template<typename BasicJsonType, typename T>
|
||||||
struct has_from_json
|
struct has_from_json
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
// also check the return type of from_json
|
// also check the return type of from_json
|
||||||
template<typename U, typename = enable_if_t<std::is_same<void, decltype(uncvref_t<U>::from_json(
|
template<typename U, typename = enable_if_t<std::is_same<void, decltype(uncvref_t<U>::from_json(
|
||||||
std::declval<BasicJsonType>(), std::declval<T&>()))>::value>>
|
std::declval<BasicJsonType>(), std::declval<T&>()))>::value>>
|
||||||
static int detect(U&&);
|
static int detect(U&&);
|
||||||
static void detect(...);
|
static void detect(...);
|
||||||
|
|
||||||
public:
|
|
||||||
static constexpr bool value = std::is_integral<decltype(
|
static constexpr bool value = std::is_integral<decltype(
|
||||||
detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
||||||
};
|
};
|
||||||
|
@ -488,7 +484,6 @@ struct has_from_json
|
||||||
template<typename BasicJsonType, typename T>
|
template<typename BasicJsonType, typename T>
|
||||||
struct has_non_default_from_json
|
struct has_non_default_from_json
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
template <
|
template <
|
||||||
typename U,
|
typename U,
|
||||||
typename = enable_if_t<std::is_same<
|
typename = enable_if_t<std::is_same<
|
||||||
|
@ -496,7 +491,6 @@ struct has_non_default_from_json
|
||||||
static int detect(U&&);
|
static int detect(U&&);
|
||||||
static void detect(...);
|
static void detect(...);
|
||||||
|
|
||||||
public:
|
|
||||||
static constexpr bool value = std::is_integral<decltype(detect(
|
static constexpr bool value = std::is_integral<decltype(detect(
|
||||||
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
||||||
};
|
};
|
||||||
|
@ -505,13 +499,11 @@ struct has_non_default_from_json
|
||||||
template<typename BasicJsonType, typename T>
|
template<typename BasicJsonType, typename T>
|
||||||
struct has_to_json
|
struct has_to_json
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
template<typename U, typename = decltype(uncvref_t<U>::to_json(
|
template<typename U, typename = decltype(uncvref_t<U>::to_json(
|
||||||
std::declval<BasicJsonType&>(), std::declval<T>()))>
|
std::declval<BasicJsonType&>(), std::declval<T>()))>
|
||||||
static int detect(U&&);
|
static int detect(U&&);
|
||||||
static void detect(...);
|
static void detect(...);
|
||||||
|
|
||||||
public:
|
|
||||||
static constexpr bool value = std::is_integral<decltype(detect(
|
static constexpr bool value = std::is_integral<decltype(detect(
|
||||||
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue