💚 fix build

This commit is contained in:
Niels Lohmann 2021-03-25 13:31:11 +01:00
parent 360f21e110
commit 2f2c75942b
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
4 changed files with 34 additions and 22 deletions

View File

@ -23,7 +23,8 @@ const_reference at(const json_pointer& ptr) const;
## Template parameters
`KeyT`
: A type convertible to an object key. This can also be a string literal or a string view (C++17).
: A type for an object key other than `basic_json::json_pointer`. This can also be a string literal or a string view
(C++17).
## Parameters

View File

@ -27,7 +27,8 @@ const_reference operator[](const json_pointer& ptr) const;
## Template parameters
`KeyT`
: A type convertible to an object key. This can also be a string literal or a string view (C++17).
: A type for an object key other than `basic_json::json_pointer`. This can also be a string literal or a string view
(C++17).
`T`
: string literal convertible to `object_t::key_type`

View File

@ -3494,10 +3494,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
can be thrown.,at__object_t_key_type}
*/
template < class KeyT, typename std::enable_if <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& (
#if defined(JSON_HAS_CPP_17)
std::is_same<KeyT, std::string_view>::value ||
std::is_same<KeyT, std::string_view>::value ||
#endif
std::is_convertible<KeyT, typename object_t::key_type>::value, int >::type = 0 >
std::is_convertible<KeyT, typename object_t::key_type>::value), int >::type = 0 >
reference at(KeyT && key)
{
// at only works for objects
@ -3546,10 +3547,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
at__object_t_key_type_const}
*/
template < class KeyT, typename std::enable_if <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& (
#if defined(JSON_HAS_CPP_17)
std::is_same<KeyT, std::string_view>::value ||
std::is_same<KeyT, std::string_view>::value ||
#endif
std::is_convertible<KeyT, typename object_t::key_type>::value, int >::type = 0 >
std::is_convertible<KeyT, typename object_t::key_type>::value), int >::type = 0 >
const_reference at(KeyT && key) const
{
// at only works for objects
@ -3684,10 +3686,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0
*/
template < class KeyT, typename std::enable_if <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& (
#if defined(JSON_HAS_CPP_17)
std::is_same<KeyT, std::string_view>::value ||
std::is_same<KeyT, std::string_view>::value ||
#endif
std::is_convertible<KeyT, typename object_t::key_type>::value, int >::type = 0 >
std::is_convertible<KeyT, typename object_t::key_type>::value), int >::type = 0 >
reference operator[](KeyT && key)
{
// implicitly convert null value to an empty object
@ -3739,17 +3742,19 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0
*/
template < class KeyT, typename std::enable_if <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& (
#if defined(JSON_HAS_CPP_17)
std::is_same<KeyT, std::string_view>::value ||
std::is_same<KeyT, std::string_view>::value ||
#endif
std::is_convertible<KeyT, typename object_t::key_type>::value, int >::type = 0 >
std::is_convertible<KeyT, typename object_t::key_type>::value), int >::type = 0 >
const_reference operator[](KeyT && key) const
{
// const operator[] only works for objects
if (JSON_HEDLEY_LIKELY(is_object()))
{
JSON_ASSERT(m_value.object->find(std::forward<KeyT>(key)) != m_value.object->end());
return m_value.object->find(key)->second;
auto it = m_value.object->find(std::forward<KeyT>(key));
JSON_ASSERT(it != m_value.object->end());
return it->second;
}
JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()), *this));

View File

@ -20307,10 +20307,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
can be thrown.,at__object_t_key_type}
*/
template < class KeyT, typename std::enable_if <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& (
#if defined(JSON_HAS_CPP_17)
std::is_same<KeyT, std::string_view>::value ||
std::is_same<KeyT, std::string_view>::value ||
#endif
std::is_convertible<KeyT, typename object_t::key_type>::value, int >::type = 0 >
std::is_convertible<KeyT, typename object_t::key_type>::value), int >::type = 0 >
reference at(KeyT && key)
{
// at only works for objects
@ -20359,10 +20360,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
at__object_t_key_type_const}
*/
template < class KeyT, typename std::enable_if <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& (
#if defined(JSON_HAS_CPP_17)
std::is_same<KeyT, std::string_view>::value ||
std::is_same<KeyT, std::string_view>::value ||
#endif
std::is_convertible<KeyT, typename object_t::key_type>::value, int >::type = 0 >
std::is_convertible<KeyT, typename object_t::key_type>::value), int >::type = 0 >
const_reference at(KeyT && key) const
{
// at only works for objects
@ -20497,10 +20499,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0
*/
template < class KeyT, typename std::enable_if <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& (
#if defined(JSON_HAS_CPP_17)
std::is_same<KeyT, std::string_view>::value ||
std::is_same<KeyT, std::string_view>::value ||
#endif
std::is_convertible<KeyT, typename object_t::key_type>::value, int >::type = 0 >
std::is_convertible<KeyT, typename object_t::key_type>::value), int >::type = 0 >
reference operator[](KeyT && key)
{
// implicitly convert null value to an empty object
@ -20552,17 +20555,19 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0
*/
template < class KeyT, typename std::enable_if <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& (
#if defined(JSON_HAS_CPP_17)
std::is_same<KeyT, std::string_view>::value ||
std::is_same<KeyT, std::string_view>::value ||
#endif
std::is_convertible<KeyT, typename object_t::key_type>::value, int >::type = 0 >
std::is_convertible<KeyT, typename object_t::key_type>::value), int >::type = 0 >
const_reference operator[](KeyT && key) const
{
// const operator[] only works for objects
if (JSON_HEDLEY_LIKELY(is_object()))
{
JSON_ASSERT(m_value.object->find(std::forward<KeyT>(key)) != m_value.object->end());
return m_value.object->find(key)->second;
auto it = m_value.object->find(std::forward<KeyT>(key));
JSON_ASSERT(it != m_value.object->end());
return it->second;
}
JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()), *this));