mirror of
https://github.com/nlohmann/json.git
synced 2026-11-04 19:59:23 +00:00
Merge pull request #2104 from dota17/issue#2086
Fix issue#2086: disallow json::value_t type parameter in value()
This commit is contained in:
2 files changed
+4
-2
No files matched your search
@@ -3768,7 +3768,8 @@ class basic_json
|
|||||||
@since version 1.0.0
|
@since version 1.0.0
|
||||||
*/
|
*/
|
||||||
template<class ValueType, typename std::enable_if<
|
template<class ValueType, typename std::enable_if<
|
||||||
std::is_convertible<basic_json_t, ValueType>::value, int>::type = 0>
|
std::is_convertible<basic_json_t, ValueType>::value
|
||||||
|
and not std::is_same<value_t, ValueType>::value, int>::type = 0>
|
||||||
ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
|
ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
|
||||||
{
|
{
|
||||||
// at only works for objects
|
// at only works for objects
|
||||||
|
|||||||
@@ -19560,7 +19560,8 @@ class basic_json
|
|||||||
@since version 1.0.0
|
@since version 1.0.0
|
||||||
*/
|
*/
|
||||||
template<class ValueType, typename std::enable_if<
|
template<class ValueType, typename std::enable_if<
|
||||||
std::is_convertible<basic_json_t, ValueType>::value, int>::type = 0>
|
std::is_convertible<basic_json_t, ValueType>::value
|
||||||
|
and not std::is_same<value_t, ValueType>::value, int>::type = 0>
|
||||||
ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
|
ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
|
||||||
{
|
{
|
||||||
// at only works for objects
|
// at only works for objects
|
||||||
|
|||||||
Reference in new issue
Block a user