Skip to content

Commit

Permalink
🚨 fixed a compiler warning #1224
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Sep 6, 2018
1 parent d713727 commit eb30ff0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ pedantic_gcc:
-Wunused-macros \
-Wunused-parameter \
-Wuseless-cast \
-Wvariadic-macros"
-Wvariadic-macros \
-Wctor-dtor-privacy \
-Winit-self \
-Wstrict-null-sentinel"

##########################################################################
# benchmarks
Expand Down
2 changes: 0 additions & 2 deletions include/nlohmann/detail/macro_scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ contains a `mapped_type`, whereas `std::vector` fails the test.
*/
#define NLOHMANN_JSON_HAS_HELPER(type) \
template<typename T> struct has_##type { \
private: \
template<typename U, typename = typename U::type> \
static int detect(U &&); \
static void detect(...); \
public: \
static constexpr bool value = \
std::is_integral<decltype(detect(std::declval<T>()))>::value; \
}
6 changes: 0 additions & 6 deletions include/nlohmann/detail/meta/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@ struct is_compatible_integer_type
template<typename BasicJsonType, typename T>
struct has_from_json
{
private:
// 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(
std::declval<BasicJsonType>(), std::declval<T&>()))>::value>>
static int detect(U&&);
static void detect(...);

public:
static constexpr bool value = std::is_integral<decltype(
detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
};
Expand All @@ -158,15 +156,13 @@ struct has_from_json
template<typename BasicJsonType, typename T>
struct has_non_default_from_json
{
private:
template <
typename U,
typename = enable_if_t<std::is_same<
T, decltype(uncvref_t<U>::from_json(std::declval<BasicJsonType>()))>::value >>
static int detect(U&&);
static void detect(...);

public:
static constexpr bool value = std::is_integral<decltype(detect(
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
};
Expand All @@ -175,13 +171,11 @@ struct has_non_default_from_json
template<typename BasicJsonType, typename T>
struct has_to_json
{
private:
template<typename U, typename = decltype(uncvref_t<U>::to_json(
std::declval<BasicJsonType&>(), std::declval<T>()))>
static int detect(U&&);
static void detect(...);

public:
static constexpr bool value = std::is_integral<decltype(detect(
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
};
Expand Down
8 changes: 0 additions & 8 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,9 @@ contains a `mapped_type`, whereas `std::vector` fails the test.
*/
#define NLOHMANN_JSON_HAS_HELPER(type) \
template<typename T> struct has_##type { \
private: \
template<typename U, typename = typename U::type> \
static int detect(U &&); \
static void detect(...); \
public: \
static constexpr bool value = \
std::is_integral<decltype(detect(std::declval<T>()))>::value; \
}
Expand Down Expand Up @@ -471,14 +469,12 @@ struct is_compatible_integer_type
template<typename BasicJsonType, typename T>
struct has_from_json
{
private:
// 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(
std::declval<BasicJsonType>(), std::declval<T&>()))>::value>>
static int detect(U&&);
static void detect(...);

public:
static constexpr bool value = std::is_integral<decltype(
detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
};
Expand All @@ -488,15 +484,13 @@ struct has_from_json
template<typename BasicJsonType, typename T>
struct has_non_default_from_json
{
private:
template <
typename U,
typename = enable_if_t<std::is_same<
T, decltype(uncvref_t<U>::from_json(std::declval<BasicJsonType>()))>::value >>
static int detect(U&&);
static void detect(...);

public:
static constexpr bool value = std::is_integral<decltype(detect(
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
};
Expand All @@ -505,13 +499,11 @@ struct has_non_default_from_json
template<typename BasicJsonType, typename T>
struct has_to_json
{
private:
template<typename U, typename = decltype(uncvref_t<U>::to_json(
std::declval<BasicJsonType&>(), std::declval<T>()))>
static int detect(U&&);
static void detect(...);

public:
static constexpr bool value = std::is_integral<decltype(detect(
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
};
Expand Down

0 comments on commit eb30ff0

Please sign in to comment.