👌 fix code according to review comments
This commit is contained in:
parent
575c28ca4c
commit
1bd8a10225
@ -3863,7 +3863,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
|||||||
return it->template get<typename std::decay<ValueType>::type>();
|
return it->template get<typename std::decay<ValueType>::type>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return default_value;
|
return std::forward<ValueType>(default_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name()), *this));
|
JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name()), *this));
|
||||||
@ -3877,11 +3877,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
|||||||
detail::is_usable_as_key_type<basic_json_t, KeyType>::value > ... >
|
detail::is_usable_as_key_type<basic_json_t, KeyType>::value > ... >
|
||||||
string_t value(const KeyType& key, const char* default_value) const
|
string_t value(const KeyType& key, const char* default_value) const
|
||||||
{
|
{
|
||||||
#ifdef JSON_HAS_CPP_17
|
|
||||||
return value(key, std::string_view(default_value));
|
|
||||||
#else
|
|
||||||
return value(key, string_t(default_value));
|
return value(key, string_t(default_value));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@ -20953,7 +20953,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
|||||||
return it->template get<typename std::decay<ValueType>::type>();
|
return it->template get<typename std::decay<ValueType>::type>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return default_value;
|
return std::forward<ValueType>(default_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name()), *this));
|
JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name()), *this));
|
||||||
@ -20967,11 +20967,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
|||||||
detail::is_usable_as_key_type<basic_json_t, KeyType>::value > ... >
|
detail::is_usable_as_key_type<basic_json_t, KeyType>::value > ... >
|
||||||
string_t value(const KeyType& key, const char* default_value) const
|
string_t value(const KeyType& key, const char* default_value) const
|
||||||
{
|
{
|
||||||
#ifdef JSON_HAS_CPP_17
|
|
||||||
return value(key, std::string_view(default_value));
|
|
||||||
#else
|
|
||||||
return value(key, string_t(default_value));
|
return value(key, string_t(default_value));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user