MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / operator[]

Function operator[]

3rd/nlohmann_json/single_include/nlohmann/json.hpp:12258–12290  ·  view source on GitHub ↗

! @brief access to successor @pre The iterator is initialized; i.e. `m_object != nullptr`. */

Source from the content-addressed store, hash-verified

12256 @pre The iterator is initialized; i.e. `m_object != nullptr`.
12257 */
12258 reference operator[](difference_type n) const
12259 {
12260 JSON_ASSERT(m_object != nullptr);
12261
12262 switch (m_object->m_type)
12263 {
12264 case value_t::object:
12265 JSON_THROW(invalid_iterator::create(208, "cannot use operator[] for object iterators", *m_object));
12266
12267 case value_t::array:
12268 return *std::next(m_it.array_iterator, n);
12269
12270 case value_t::null:
12271 JSON_THROW(invalid_iterator::create(214, "cannot get value", *m_object));
12272
12273 case value_t::string:
12274 case value_t::boolean:
12275 case value_t::number_integer:
12276 case value_t::number_unsigned:
12277 case value_t::number_float:
12278 case value_t::binary:
12279 case value_t::discarded:
12280 default:
12281 {
12282 if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.get_value() == -n))
12283 {
12284 return *m_object;
12285 }
12286
12287 JSON_THROW(invalid_iterator::create(214, "cannot get value", *m_object));
12288 }
12289 }
12290 }
12291
12292 /*!
12293 @brief return the key of an object iterator

Callers

nothing calls this directly

Calls 15

nextFunction · 0.85
stringFunction · 0.85
createFunction · 0.70
is_nullFunction · 0.70
is_arrayFunction · 0.70
set_parentsFunction · 0.70
beginFunction · 0.70
type_nameFunction · 0.70
is_objectFunction · 0.70
set_parentFunction · 0.70
get_valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected