MCPcopy Create free account
hub / github.com/TrunkRecorder/trunk-recorder / insert_iterator

Function insert_iterator

lib/json.hpp:23307–23322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23305 /// see https://github.com/nlohmann/json/pull/1257
23306 template<typename... Args>
23307 iterator insert_iterator(const_iterator pos, Args&& ... args) // NOLINT(performance-unnecessary-value-param)
23308 {
23309 iterator result(this);
23310 JSON_ASSERT(m_data.m_value.array != nullptr);
23311
23312 auto insert_pos = std::distance(m_data.m_value.array->begin(), pos.m_it.array_iterator);
23313 m_data.m_value.array->insert(pos.m_it.array_iterator, std::forward<Args>(args)...);
23314 result.m_it.array_iterator = m_data.m_value.array->begin() + insert_pos;
23315
23316 // This could have been written as:
23317 // result.m_it.array_iterator = m_data.m_value.array->insert(pos.m_it.array_iterator, cnt, val);
23318 // but the return value of insert is missing in GCC 4.8, so it is written this way instead.
23319
23320 set_parents();
23321 return result;
23322 }
23323
23324 /// @brief inserts element into array
23325 /// @sa https://json.nlohmann.me/api/basic_json/insert/

Callers 1

insertFunction · 0.85

Calls 3

set_parentsFunction · 0.85
beginMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected