🚨 fix warnings

This commit is contained in:
Niels Lohmann 2021-08-20 13:42:49 +02:00
parent 83c930db2b
commit a653131cf0
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
3 changed files with 14 additions and 12 deletions

View File

@ -451,20 +451,19 @@ T conditional_static_cast(U value)
// helper to check if a type has bucket_count function (and hence can tell a std::map and a std::unordered_map apart)
template <typename T>
class has_bucket_count
struct has_bucket_count
{
typedef char one;
using one = char;
struct two
{
char x[2];
char x[2]; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
};
template <typename C> static one test( decltype(&C::bucket_count) ) ;
template <typename C> static two test(...);
public:
enum { value = sizeof(test<T>(0)) == sizeof(char) };
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) };
};
} // namespace detail

View File

@ -422,8 +422,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// Use transparent comparator if possible, combined with perfect forwarding
// on find() and count() calls prevents unnecessary string construction.
using object_comparator_t = std::less<>;
using key_equal_t = std::equal_to<>;
#else
using object_comparator_t = std::less<StringType>;
using key_equal_t = std::equal_to<StringType>;
#endif
/*!
@ -515,7 +517,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
std::unordered_map<StringType,
basic_json,
std::hash<StringType>,
std::equal_to<StringType>,
key_equal_t,
AllocatorType<std::pair<const StringType,
basic_json>>>,

View File

@ -3862,20 +3862,19 @@ T conditional_static_cast(U value)
// helper to check if a type has bucket_count function (and hence can tell a std::map and a std::unordered_map apart)
template <typename T>
class has_bucket_count
struct has_bucket_count
{
typedef char one;
using one = char;
struct two
{
char x[2];
char x[2]; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
};
template <typename C> static one test( decltype(&C::bucket_count) ) ;
template <typename C> static two test(...);
public:
enum { value = sizeof(test<T>(0)) == sizeof(char) };
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) };
};
} // namespace detail
@ -17823,8 +17822,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// Use transparent comparator if possible, combined with perfect forwarding
// on find() and count() calls prevents unnecessary string construction.
using object_comparator_t = std::less<>;
using key_equal_t = std::equal_to<>;
#else
using object_comparator_t = std::less<StringType>;
using key_equal_t = std::equal_to<StringType>;
#endif
/*!
@ -17916,7 +17917,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
std::unordered_map<StringType,
basic_json,
std::hash<StringType>,
std::equal_to<StringType>,
key_equal_t,
AllocatorType<std::pair<const StringType,
basic_json>>>,