MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / insert

Function insert

src/include/nlohmann/json.hpp:3314–3330  ·  view source on GitHub ↗

@brief inserts element into array @sa https://json.nlohmann.me/api/basic_json/insert/

Source from the content-addressed store, hash-verified

3312 /// @brief inserts element into array
3313 /// @sa https://json.nlohmann.me/api/basic_json/insert/
3314 iterator insert(const_iterator pos, const basic_json& val) // NOLINT(performance-unnecessary-value-param)
3315 {
3316 // insert only works for arrays
3317 if (JSON_HEDLEY_LIKELY(is_array()))
3318 {
3319 // check if iterator pos fits to this JSON value
3320 if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))
3321 {
3322 JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value", this));
3323 }
3324
3325 // insert to array and return iterator
3326 return insert_iterator(pos, val);
3327 }
3328
3329 JSON_THROW(type_error::create(309, detail::concat("cannot use insert() with ", type_name()), this));
3330 }
3331
3332 /// @brief inserts element into array
3333 /// @sa https://json.nlohmann.me/api/basic_json/insert/

Callers

nothing calls this directly

Calls 11

is_arrayFunction · 0.85
createFunction · 0.85
insert_iteratorFunction · 0.85
concatFunction · 0.85
type_nameFunction · 0.85
is_objectFunction · 0.85
set_parentsFunction · 0.85
is_objectMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected