-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
confirmedsolution: wontfixthe issue will not be fixed (either it is impossible or deemed out of scope)the issue will not be fixed (either it is impossible or deemed out of scope)state: help neededthe issue needs help to proceedthe issue needs help to proceed
Description
json::value(const json_pointer&, ValueType) is defined as:
template<class ValueType, typename std::enable_if<
std::is_convertible<basic_json_t, ValueType>::value, int>::type = 0>
ValueType value(const json_pointer& ptr, ValueType default_value) const
{
// at only works for objects
if (is_object())
{
// if pointer resolves a value, return it or use default value
JSON_TRY
{
return ptr.get_checked(this);
}
JSON_CATCH (std::out_of_range&)
{
return default_value;
}
}
JSON_THROW(std::domain_error("cannot use value() with " + type_name()));
}If exceptions are disabled, JSON_TRY turns into if (true) and JSON_CATCH turns into if (false), this means that the default value will never be returned if exceptions are turned off.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
confirmedsolution: wontfixthe issue will not be fixed (either it is impossible or deemed out of scope)the issue will not be fixed (either it is impossible or deemed out of scope)state: help neededthe issue needs help to proceedthe issue needs help to proceed