1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-28 12:02:00 +03:00

🚨 fix warning

This commit is contained in:
Niels Lohmann
2024-03-15 17:27:37 +01:00
parent 57e22b996e
commit b131d285ed
15 changed files with 85 additions and 85 deletions

View File

@ -79,8 +79,8 @@ int main()
// visit and output // visit and output
j.visit( j.visit(
[&](const json::json_pointer & p, [&](const json::json_pointer & p,
const json & j) const json & j)
{ {
std::cout << (p.empty() ? std::string{"/"} : p.to_string()) std::cout << (p.empty() ? std::string{"/"} : p.to_string())
<< " - metadata = " << j.metadata << " -> " << j.dump() << '\n'; << " - metadata = " << j.metadata << " -> " << j.dump() << '\n';

View File

@ -275,7 +275,7 @@ void())
template < typename BasicJsonType, typename T, std::size_t... Idx > template < typename BasicJsonType, typename T, std::size_t... Idx >
std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType&& j, std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType&& j,
identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/) identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/)
{ {
return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } }; return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } };
} }

View File

@ -220,7 +220,7 @@ namespace std
#endif #endif
template<typename IteratorType> template<typename IteratorType>
class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> // NOLINT(cert-dcl58-cpp) class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> // NOLINT(cert-dcl58-cpp)
: public std::integral_constant<std::size_t, 2> {}; : public std::integral_constant<std::size_t, 2> {};
template<std::size_t N, typename IteratorType> template<std::size_t N, typename IteratorType>
class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> // NOLINT(cert-dcl58-cpp) class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> // NOLINT(cert-dcl58-cpp)

View File

@ -43,7 +43,7 @@ struct iterator_traits
template<typename T> template<typename T>
struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >> struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
: iterator_types<T> : iterator_types<T>
{ {
}; };

View File

@ -162,7 +162,7 @@ struct static_const
#endif #endif
template<typename T, typename... Args> template<typename T, typename... Args>
inline constexpr std::array<T, sizeof...(Args)> make_array(Args&& ... args) constexpr std::array<T, sizeof...(Args)> make_array(Args&& ... args)
{ {
return std::array<T, sizeof...(Args)> {{static_cast<T>(std::forward<Args>(args))...}}; return std::array<T, sizeof...(Args)> {{static_cast<T>(std::forward<Args>(args))...}};
} }

View File

@ -261,19 +261,19 @@ struct is_default_constructible : std::is_default_constructible<T> {};
template <typename T1, typename T2> template <typename T1, typename T2>
struct is_default_constructible<std::pair<T1, T2>> struct is_default_constructible<std::pair<T1, T2>>
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {}; : conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
template <typename T1, typename T2> template <typename T1, typename T2>
struct is_default_constructible<const std::pair<T1, T2>> struct is_default_constructible<const std::pair<T1, T2>>
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {}; : conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
template <typename... Ts> template <typename... Ts>
struct is_default_constructible<std::tuple<Ts...>> struct is_default_constructible<std::tuple<Ts...>>
: conjunction<is_default_constructible<Ts>...> {}; : conjunction<is_default_constructible<Ts>...> {};
template <typename... Ts> template <typename... Ts>
struct is_default_constructible<const std::tuple<Ts...>> struct is_default_constructible<const std::tuple<Ts...>>
: conjunction<is_default_constructible<Ts>...> {}; : conjunction<is_default_constructible<Ts>...> {};
template <typename T, typename... Args> template <typename T, typename... Args>
struct is_constructible : std::is_constructible<T, Args...> {}; struct is_constructible : std::is_constructible<T, Args...> {};
@ -471,8 +471,8 @@ is_detected<range_value_t, ConstructibleArrayType>::value&&
// special case for types like std::filesystem::path whose iterator's value_type are themselves // special case for types like std::filesystem::path whose iterator's value_type are themselves
// c.f. https://github.com/nlohmann/json/pull/3073 // c.f. https://github.com/nlohmann/json/pull/3073
!std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>::value&& !std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>::value&&
is_complete_type < is_complete_type <
detected_t<range_value_t, ConstructibleArrayType >>::value >> detected_t<range_value_t, ConstructibleArrayType >>::value >>
{ {
using value_type = range_value_t<ConstructibleArrayType>; using value_type = range_value_t<ConstructibleArrayType>;
@ -595,12 +595,12 @@ using is_usable_as_key_type = typename std::conditional <
template<typename BasicJsonType, typename KeyTypeCVRef, bool RequireTransparentComparator = true, template<typename BasicJsonType, typename KeyTypeCVRef, bool RequireTransparentComparator = true,
bool ExcludeObjectKeyType = RequireTransparentComparator, typename KeyType = uncvref_t<KeyTypeCVRef>> bool ExcludeObjectKeyType = RequireTransparentComparator, typename KeyType = uncvref_t<KeyTypeCVRef>>
using is_usable_as_basic_json_key_type = typename std::conditional < using is_usable_as_basic_json_key_type = typename std::conditional <
is_usable_as_key_type<typename BasicJsonType::object_comparator_t, is_usable_as_key_type<typename BasicJsonType::object_comparator_t,
typename BasicJsonType::object_t::key_type, KeyTypeCVRef, typename BasicJsonType::object_t::key_type, KeyTypeCVRef,
RequireTransparentComparator, ExcludeObjectKeyType>::value RequireTransparentComparator, ExcludeObjectKeyType>::value
&& !is_json_iterator_of<BasicJsonType, KeyType>::value, && !is_json_iterator_of<BasicJsonType, KeyType>::value,
std::true_type, std::true_type,
std::false_type >::type; std::false_type >::type;
template<typename ObjectType, typename KeyType> template<typename ObjectType, typename KeyType>
using detect_erase_with_key_type = decltype(std::declval<ObjectType&>().erase(std::declval<KeyType>())); using detect_erase_with_key_type = decltype(std::declval<ObjectType&>().erase(std::declval<KeyType>()));
@ -734,7 +734,7 @@ struct value_in_range_of_impl1<OfType, T, true>
}; };
template<typename OfType, typename T> template<typename OfType, typename T>
inline constexpr bool value_in_range_of(T val) constexpr bool value_in_range_of(T val)
{ {
return value_in_range_of_impl1<OfType, T>::test(val); return value_in_range_of_impl1<OfType, T>::test(val);
} }
@ -750,7 +750,7 @@ namespace impl
{ {
template<typename T> template<typename T>
inline constexpr bool is_c_string() constexpr bool is_c_string()
{ {
using TUnExt = typename std::remove_extent<T>::type; using TUnExt = typename std::remove_extent<T>::type;
using TUnCVExt = typename std::remove_cv<TUnExt>::type; using TUnCVExt = typename std::remove_cv<TUnExt>::type;
@ -778,7 +778,7 @@ namespace impl
{ {
template<typename T> template<typename T>
inline constexpr bool is_transparent() constexpr bool is_transparent()
{ {
return is_detected<detect_is_transparent, T>::value; return is_detected<detect_is_transparent, T>::value;
} }

View File

@ -643,7 +643,7 @@ class serializer
@param[in] x unsigned integer number to count its digits @param[in] x unsigned integer number to count its digits
@return number of decimal digits @return number of decimal digits
*/ */
inline unsigned int count_digits(number_unsigned_t x) noexcept unsigned int count_digits(number_unsigned_t x) noexcept
{ {
unsigned int n_digits = 1; unsigned int n_digits = 1;
for (;;) for (;;)
@ -952,7 +952,7 @@ class serializer
* absolute values of INT_MIN and INT_MAX are usually not the same. See * absolute values of INT_MIN and INT_MAX are usually not the same. See
* #1708 for details. * #1708 for details.
*/ */
inline number_unsigned_t remove_sign(number_integer_t x) noexcept number_unsigned_t remove_sign(number_integer_t x) noexcept
{ {
JSON_ASSERT(x < 0 && x < (std::numeric_limits<number_integer_t>::max)()); // NOLINT(misc-redundant-expression) JSON_ASSERT(x < 0 && x < (std::numeric_limits<number_integer_t>::max)()); // NOLINT(misc-redundant-expression)
return static_cast<number_unsigned_t>(-(x + 1)) + 1; return static_cast<number_unsigned_t>(-(x + 1)) + 1;

View File

@ -137,7 +137,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
) )
{ {
return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter), return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
std::move(cb), allow_exceptions, ignore_comments); std::move(cb), allow_exceptions, ignore_comments);
} }
private: private:

View File

@ -26,7 +26,7 @@ NLOHMANN_JSON_NAMESPACE_BEGIN
/// for use within nlohmann::basic_json<ordered_map> /// for use within nlohmann::basic_json<ordered_map>
template <class Key, class T, class IgnoredLess = std::less<Key>, template <class Key, class T, class IgnoredLess = std::less<Key>,
class Allocator = std::allocator<std::pair<const Key, T>>> class Allocator = std::allocator<std::pair<const Key, T>>>
struct ordered_map : std::vector<std::pair<const Key, T>, Allocator> struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>
{ {
using key_type = Key; using key_type = Key;
using mapped_type = T; using mapped_type = T;
@ -341,7 +341,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<typename InputIt> template<typename InputIt>
using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category, using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category,
std::input_iterator_tag>::value>::type; std::input_iterator_tag>::value>::type;
template<typename InputIt, typename = require_input_iter<InputIt>> template<typename InputIt, typename = require_input_iter<InputIt>>
void insert(InputIt first, InputIt last) void insert(InputIt first, InputIt last)

View File

@ -3219,7 +3219,7 @@ struct static_const
#endif #endif
template<typename T, typename... Args> template<typename T, typename... Args>
inline constexpr std::array<T, sizeof...(Args)> make_array(Args&& ... args) constexpr std::array<T, sizeof...(Args)> make_array(Args&& ... args)
{ {
return std::array<T, sizeof...(Args)> {{static_cast<T>(std::forward<Args>(args))...}}; return std::array<T, sizeof...(Args)> {{static_cast<T>(std::forward<Args>(args))...}};
} }
@ -3293,7 +3293,7 @@ struct iterator_traits
template<typename T> template<typename T>
struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >> struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
: iterator_types<T> : iterator_types<T>
{ {
}; };
@ -3674,19 +3674,19 @@ struct is_default_constructible : std::is_default_constructible<T> {};
template <typename T1, typename T2> template <typename T1, typename T2>
struct is_default_constructible<std::pair<T1, T2>> struct is_default_constructible<std::pair<T1, T2>>
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {}; : conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
template <typename T1, typename T2> template <typename T1, typename T2>
struct is_default_constructible<const std::pair<T1, T2>> struct is_default_constructible<const std::pair<T1, T2>>
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {}; : conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
template <typename... Ts> template <typename... Ts>
struct is_default_constructible<std::tuple<Ts...>> struct is_default_constructible<std::tuple<Ts...>>
: conjunction<is_default_constructible<Ts>...> {}; : conjunction<is_default_constructible<Ts>...> {};
template <typename... Ts> template <typename... Ts>
struct is_default_constructible<const std::tuple<Ts...>> struct is_default_constructible<const std::tuple<Ts...>>
: conjunction<is_default_constructible<Ts>...> {}; : conjunction<is_default_constructible<Ts>...> {};
template <typename T, typename... Args> template <typename T, typename... Args>
struct is_constructible : std::is_constructible<T, Args...> {}; struct is_constructible : std::is_constructible<T, Args...> {};
@ -3884,8 +3884,8 @@ is_detected<range_value_t, ConstructibleArrayType>::value&&
// special case for types like std::filesystem::path whose iterator's value_type are themselves // special case for types like std::filesystem::path whose iterator's value_type are themselves
// c.f. https://github.com/nlohmann/json/pull/3073 // c.f. https://github.com/nlohmann/json/pull/3073
!std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>::value&& !std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>::value&&
is_complete_type < is_complete_type <
detected_t<range_value_t, ConstructibleArrayType >>::value >> detected_t<range_value_t, ConstructibleArrayType >>::value >>
{ {
using value_type = range_value_t<ConstructibleArrayType>; using value_type = range_value_t<ConstructibleArrayType>;
@ -4008,12 +4008,12 @@ using is_usable_as_key_type = typename std::conditional <
template<typename BasicJsonType, typename KeyTypeCVRef, bool RequireTransparentComparator = true, template<typename BasicJsonType, typename KeyTypeCVRef, bool RequireTransparentComparator = true,
bool ExcludeObjectKeyType = RequireTransparentComparator, typename KeyType = uncvref_t<KeyTypeCVRef>> bool ExcludeObjectKeyType = RequireTransparentComparator, typename KeyType = uncvref_t<KeyTypeCVRef>>
using is_usable_as_basic_json_key_type = typename std::conditional < using is_usable_as_basic_json_key_type = typename std::conditional <
is_usable_as_key_type<typename BasicJsonType::object_comparator_t, is_usable_as_key_type<typename BasicJsonType::object_comparator_t,
typename BasicJsonType::object_t::key_type, KeyTypeCVRef, typename BasicJsonType::object_t::key_type, KeyTypeCVRef,
RequireTransparentComparator, ExcludeObjectKeyType>::value RequireTransparentComparator, ExcludeObjectKeyType>::value
&& !is_json_iterator_of<BasicJsonType, KeyType>::value, && !is_json_iterator_of<BasicJsonType, KeyType>::value,
std::true_type, std::true_type,
std::false_type >::type; std::false_type >::type;
template<typename ObjectType, typename KeyType> template<typename ObjectType, typename KeyType>
using detect_erase_with_key_type = decltype(std::declval<ObjectType&>().erase(std::declval<KeyType>())); using detect_erase_with_key_type = decltype(std::declval<ObjectType&>().erase(std::declval<KeyType>()));
@ -4147,7 +4147,7 @@ struct value_in_range_of_impl1<OfType, T, true>
}; };
template<typename OfType, typename T> template<typename OfType, typename T>
inline constexpr bool value_in_range_of(T val) constexpr bool value_in_range_of(T val)
{ {
return value_in_range_of_impl1<OfType, T>::test(val); return value_in_range_of_impl1<OfType, T>::test(val);
} }
@ -4163,7 +4163,7 @@ namespace impl
{ {
template<typename T> template<typename T>
inline constexpr bool is_c_string() constexpr bool is_c_string()
{ {
using TUnExt = typename std::remove_extent<T>::type; using TUnExt = typename std::remove_extent<T>::type;
using TUnCVExt = typename std::remove_cv<TUnExt>::type; using TUnCVExt = typename std::remove_cv<TUnExt>::type;
@ -4191,7 +4191,7 @@ namespace impl
{ {
template<typename T> template<typename T>
inline constexpr bool is_transparent() constexpr bool is_transparent()
{ {
return is_detected<detect_is_transparent, T>::value; return is_detected<detect_is_transparent, T>::value;
} }
@ -4902,7 +4902,7 @@ void())
template < typename BasicJsonType, typename T, std::size_t... Idx > template < typename BasicJsonType, typename T, std::size_t... Idx >
std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType&& j, std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType&& j,
identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/) identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/)
{ {
return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } }; return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } };
} }
@ -5369,7 +5369,7 @@ namespace std
#endif #endif
template<typename IteratorType> template<typename IteratorType>
class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> // NOLINT(cert-dcl58-cpp) class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> // NOLINT(cert-dcl58-cpp)
: public std::integral_constant<std::size_t, 2> {}; : public std::integral_constant<std::size_t, 2> {};
template<std::size_t N, typename IteratorType> template<std::size_t N, typename IteratorType>
class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> // NOLINT(cert-dcl58-cpp) class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> // NOLINT(cert-dcl58-cpp)
@ -18652,7 +18652,7 @@ class serializer
@param[in] x unsigned integer number to count its digits @param[in] x unsigned integer number to count its digits
@return number of decimal digits @return number of decimal digits
*/ */
inline unsigned int count_digits(number_unsigned_t x) noexcept unsigned int count_digits(number_unsigned_t x) noexcept
{ {
unsigned int n_digits = 1; unsigned int n_digits = 1;
for (;;) for (;;)
@ -18961,7 +18961,7 @@ class serializer
* absolute values of INT_MIN and INT_MAX are usually not the same. See * absolute values of INT_MIN and INT_MAX are usually not the same. See
* #1708 for details. * #1708 for details.
*/ */
inline number_unsigned_t remove_sign(number_integer_t x) noexcept number_unsigned_t remove_sign(number_integer_t x) noexcept
{ {
JSON_ASSERT(x < 0 && x < (std::numeric_limits<number_integer_t>::max)()); // NOLINT(misc-redundant-expression) JSON_ASSERT(x < 0 && x < (std::numeric_limits<number_integer_t>::max)()); // NOLINT(misc-redundant-expression)
return static_cast<number_unsigned_t>(-(x + 1)) + 1; return static_cast<number_unsigned_t>(-(x + 1)) + 1;
@ -19031,7 +19031,7 @@ NLOHMANN_JSON_NAMESPACE_BEGIN
/// for use within nlohmann::basic_json<ordered_map> /// for use within nlohmann::basic_json<ordered_map>
template <class Key, class T, class IgnoredLess = std::less<Key>, template <class Key, class T, class IgnoredLess = std::less<Key>,
class Allocator = std::allocator<std::pair<const Key, T>>> class Allocator = std::allocator<std::pair<const Key, T>>>
struct ordered_map : std::vector<std::pair<const Key, T>, Allocator> struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>
{ {
using key_type = Key; using key_type = Key;
using mapped_type = T; using mapped_type = T;
@ -19346,7 +19346,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<typename InputIt> template<typename InputIt>
using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category, using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category,
std::input_iterator_tag>::value>::type; std::input_iterator_tag>::value>::type;
template<typename InputIt, typename = require_input_iter<InputIt>> template<typename InputIt, typename = require_input_iter<InputIt>>
void insert(InputIt first, InputIt last) void insert(InputIt first, InputIt last)
@ -19440,7 +19440,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
) )
{ {
return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter), return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
std::move(cb), allow_exceptions, ignore_comments); std::move(cb), allow_exceptions, ignore_comments);
} }
private: private:
@ -20136,8 +20136,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
detail::enable_if_t < detail::enable_if_t <
!detail::is_basic_json<U>::value && detail::is_compatible_type<basic_json_t, U>::value, int > = 0 > !detail::is_basic_json<U>::value && detail::is_compatible_type<basic_json_t, U>::value, int > = 0 >
basic_json(CompatibleType && val) noexcept(noexcept( // NOLINT(bugprone-forwarding-reference-overload,bugprone-exception-escape) basic_json(CompatibleType && val) noexcept(noexcept( // NOLINT(bugprone-forwarding-reference-overload,bugprone-exception-escape)
JSONSerializer<U>::to_json(std::declval<basic_json_t&>(), JSONSerializer<U>::to_json(std::declval<basic_json_t&>(),
std::forward<CompatibleType>(val)))) std::forward<CompatibleType>(val))))
{ {
JSONSerializer<U>::to_json(*this, std::forward<CompatibleType>(val)); JSONSerializer<U>::to_json(*this, std::forward<CompatibleType>(val));
set_parents(); set_parents();
@ -20907,7 +20907,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
detail::has_from_json<basic_json_t, ValueType>::value, detail::has_from_json<basic_json_t, ValueType>::value,
int > = 0 > int > = 0 >
ValueType get_impl(detail::priority_tag<0> /*unused*/) const noexcept(noexcept( ValueType get_impl(detail::priority_tag<0> /*unused*/) const noexcept(noexcept(
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>()))) JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))
{ {
auto ret = ValueType(); auto ret = ValueType();
JSONSerializer<ValueType>::from_json(*this, ret); JSONSerializer<ValueType>::from_json(*this, ret);
@ -20949,7 +20949,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
detail::has_non_default_from_json<basic_json_t, ValueType>::value, detail::has_non_default_from_json<basic_json_t, ValueType>::value,
int > = 0 > int > = 0 >
ValueType get_impl(detail::priority_tag<1> /*unused*/) const noexcept(noexcept( ValueType get_impl(detail::priority_tag<1> /*unused*/) const noexcept(noexcept(
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>()))) JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>())))
{ {
return JSONSerializer<ValueType>::from_json(*this); return JSONSerializer<ValueType>::from_json(*this);
} }
@ -21099,7 +21099,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
detail::has_from_json<basic_json_t, ValueType>::value, detail::has_from_json<basic_json_t, ValueType>::value,
int > = 0 > int > = 0 >
ValueType & get_to(ValueType& v) const noexcept(noexcept( ValueType & get_to(ValueType& v) const noexcept(noexcept(
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), v))) JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), v)))
{ {
JSONSerializer<ValueType>::from_json(*this, v); JSONSerializer<ValueType>::from_json(*this, v);
return v; return v;

View File

@ -339,13 +339,13 @@ TEST_CASE("BJData")
std::vector<int32_t> const numbers std::vector<int32_t> const numbers
{ {
-32769, -32769,
-100000, -100000,
-1000000, -1000000,
-10000000, -10000000,
-100000000, -100000000,
-1000000000, -1000000000,
-2147483647 - 1, // https://stackoverflow.com/a/29356002/266378 -2147483647 - 1, // https://stackoverflow.com/a/29356002/266378
}; };
for (const auto i : numbers) for (const auto i : numbers)
{ {
CAPTURE(i) CAPTURE(i)

View File

@ -241,13 +241,13 @@ TEST_CASE("CBOR")
const std::vector<int64_t> numbers const std::vector<int64_t> numbers
{ {
-65537, -65537,
-100000, -100000,
-1000000, -1000000,
-10000000, -10000000,
-100000000, -100000000,
-1000000000, -1000000000,
-4294967296, -4294967296,
}; };
for (const auto i : numbers) for (const auto i : numbers)
{ {
CAPTURE(i) CAPTURE(i)

View File

@ -283,8 +283,8 @@ TEST_CASE("JSON Visit Node")
}; };
json.visit( json.visit(
[&](const json_with_visitor_t::json_pointer & p, [&](const json_with_visitor_t::json_pointer & p,
const json_with_visitor_t& j) const json_with_visitor_t& j)
{ {
std::stringstream str; std::stringstream str;
str << p.to_string() << " - " ; str << p.to_string() << " - " ;
@ -331,6 +331,6 @@ TEST_CASE("JSON Visit Node")
CHECK(expected.count(str.str()) == 1); CHECK(expected.count(str.str()) == 1);
expected.erase(str.str()); expected.erase(str.str());
} }
); );
CHECK(expected.empty()); CHECK(expected.empty());
} }

View File

@ -479,11 +479,11 @@ TEST_CASE("MessagePack")
std::vector<int32_t> const numbers std::vector<int32_t> const numbers
{ {
-32769, -32769,
-65536, -65536,
-77777, -77777,
-1048576, -1048576,
-2147483648LL, -2147483648LL,
}; };
for (auto i : numbers) for (auto i : numbers)
{ {
CAPTURE(i) CAPTURE(i)

View File

@ -1328,10 +1328,10 @@ TEST_CASE("regression tests 1")
{ {
std::ifstream is; std::ifstream is;
is.exceptions( is.exceptions(
is.exceptions() is.exceptions()
| std::ios_base::failbit | std::ios_base::failbit
| std::ios_base::badbit | std::ios_base::badbit
); // handle different exceptions as 'file not found', 'permission denied' ); // handle different exceptions as 'file not found', 'permission denied'
is.open(TEST_DATA_DIRECTORY "/regression/working_file.json"); is.open(TEST_DATA_DIRECTORY "/regression/working_file.json");
json _; json _;
@ -1341,10 +1341,10 @@ TEST_CASE("regression tests 1")
{ {
std::ifstream is; std::ifstream is;
is.exceptions( is.exceptions(
is.exceptions() is.exceptions()
| std::ios_base::failbit | std::ios_base::failbit
| std::ios_base::badbit | std::ios_base::badbit
); // handle different exceptions as 'file not found', 'permission denied' ); // handle different exceptions as 'file not found', 'permission denied'
is.open(TEST_DATA_DIRECTORY "/json_nlohmann_tests/all_unicode.json.cbor", is.open(TEST_DATA_DIRECTORY "/json_nlohmann_tests/all_unicode.json.cbor",
std::ios_base::in | std::ios_base::binary); std::ios_base::in | std::ios_base::binary);