MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / insert_iterator

Function insert_iterator

3rd/nlohmann_json/include/nlohmann/json.hpp:5726–5741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5724 /// see https://github.com/nlohmann/json/pull/1257
5725 template<typename... Args>
5726 iterator insert_iterator(const_iterator pos, Args&& ... args)
5727 {
5728 iterator result(this);
5729 JSON_ASSERT(m_value.array != nullptr);
5730
5731 auto insert_pos = std::distance(m_value.array->begin(), pos.m_it.array_iterator);
5732 m_value.array->insert(pos.m_it.array_iterator, std::forward<Args>(args)...);
5733 result.m_it.array_iterator = m_value.array->begin() + insert_pos;
5734
5735 // This could have been written as:
5736 // result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);
5737 // but the return value of insert is missing in GCC 4.8, so it is written this way instead.
5738
5739 set_parents();
5740 return result;
5741 }
5742
5743 /*!
5744 @brief inserts element

Callers 1

insertFunction · 0.70

Calls 3

set_parentsFunction · 0.70
beginMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected