Fix issue#2086

This commit is contained in:
chenguoping 2020-05-14 12:44:30 +08:00
parent d7b032f565
commit cdf5327ace
2 changed files with 4 additions and 2 deletions

View File

@ -3759,7 +3759,8 @@ class basic_json
@since version 1.0.0
*/
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
{
// at only works for objects

View File

@ -19205,7 +19205,8 @@ class basic_json
@since version 1.0.0
*/
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
{
// at only works for objects