MCPcopy Create free account
hub / github.com/PeterFWS/Structure-PLP-SLAM / value

Function value

3rd/json/include/nlohmann/json.hpp:16160–16176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16158 template<class ValueType, typename std::enable_if<
16159 std::is_convertible<basic_json_t, ValueType>::value, int>::type = 0>
16160 ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
16161 {
16162 // at only works for objects
16163 if (JSON_LIKELY(is_object()))
16164 {
16165 // if key is found, return value and given default value otherwise
16166 const auto it = find(key);
16167 if (it != end())
16168 {
16169 return *it;
16170 }
16171
16172 return default_value;
16173 }
16174
16175 JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name())));
16176 }
16177
16178 /*!
16179 @brief overload for a default value of type const char*

Callers 1

update_referenceMethod · 0.50

Calls 5

is_objectFunction · 0.85
type_nameFunction · 0.85
findFunction · 0.70
endFunction · 0.70
createFunction · 0.70

Tested by

no test coverage detected