Commit 9f8b270e authored by Théo DELRIEU's avatar Théo DELRIEU

fix some warnings

parent 9c6ef74a
...@@ -372,7 +372,7 @@ contains a `mapped_type`, whereas `std::vector` fails the test. ...@@ -372,7 +372,7 @@ contains a `mapped_type`, whereas `std::vector` fails the test.
public: \ 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; \
}; }
NLOHMANN_JSON_HAS_HELPER(mapped_type); NLOHMANN_JSON_HAS_HELPER(mapped_type);
NLOHMANN_JSON_HAS_HELPER(key_type); NLOHMANN_JSON_HAS_HELPER(key_type);
...@@ -3113,7 +3113,6 @@ class basic_json ...@@ -3113,7 +3113,6 @@ class basic_json
// we cannot static_assert on T being non-const, because there is support // we cannot static_assert on T being non-const, because there is support
// for get<const basic_json_t>(), which is why we still need the uncvref // for get<const basic_json_t>(), which is why we still need the uncvref
static_assert(not std::is_reference<T>::value, "get cannot be used with reference types, you might want to use get_ref"); static_assert(not std::is_reference<T>::value, "get cannot be used with reference types, you might want to use get_ref");
static_assert(not std::is_pointer<T>::value, "get cannot be used with pointer types, you might want to use get_ptr");
static_assert(std::is_default_constructible<U>::value, static_assert(std::is_default_constructible<U>::value,
"Types must be DefaultConstructible when used with get"); "Types must be DefaultConstructible when used with get");
U ret; U ret;
...@@ -3146,7 +3145,6 @@ class basic_json ...@@ -3146,7 +3145,6 @@ class basic_json
U get() const noexcept(noexcept(JSONSerializer<T>::from_json(std::declval<const basic_json_t&>()))) U get() const noexcept(noexcept(JSONSerializer<T>::from_json(std::declval<const basic_json_t&>())))
{ {
static_assert(not std::is_reference<T>::value, "get cannot be used with reference types, you might want to use get_ref"); static_assert(not std::is_reference<T>::value, "get cannot be used with reference types, you might want to use get_ref");
static_assert(not std::is_pointer<T>::value, "get cannot be used with pointer types, you might want to use get_ptr");
return JSONSerializer<T>::from_json(*this); return JSONSerializer<T>::from_json(*this);
} }
......
...@@ -372,7 +372,7 @@ contains a `mapped_type`, whereas `std::vector` fails the test. ...@@ -372,7 +372,7 @@ contains a `mapped_type`, whereas `std::vector` fails the test.
public: \ 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; \
}; }
NLOHMANN_JSON_HAS_HELPER(mapped_type); NLOHMANN_JSON_HAS_HELPER(mapped_type);
NLOHMANN_JSON_HAS_HELPER(key_type); NLOHMANN_JSON_HAS_HELPER(key_type);
......
...@@ -348,7 +348,7 @@ TEST_CASE("adl_serializer specialization", "[udt]") ...@@ -348,7 +348,7 @@ TEST_CASE("adl_serializer specialization", "[udt]")
json j = optPerson; json j = optPerson;
CHECK(j.is_null()); CHECK(j.is_null());
optPerson.reset(new udt::person{{42}, {"John Doe"}}); optPerson.reset(new udt::person{{42}, {"John Doe"}, udt::country::russia});
j = optPerson; j = optPerson;
CHECK_FALSE(j.is_null()); CHECK_FALSE(j.is_null());
...@@ -357,7 +357,7 @@ TEST_CASE("adl_serializer specialization", "[udt]") ...@@ -357,7 +357,7 @@ TEST_CASE("adl_serializer specialization", "[udt]")
SECTION("from_json") SECTION("from_json")
{ {
auto person = udt::person{{42}, {"John Doe"}}; auto person = udt::person{{42}, {"John Doe"}, udt::country::russia};
json j = person; json j = person;
auto optPerson = j.get<std::shared_ptr<udt::person>>(); auto optPerson = j.get<std::shared_ptr<udt::person>>();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment