MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / insert_iterator

Function insert_iterator

include/behaviortree_cpp/contrib/json.hpp:22568–22583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22566 /// see https://github.com/nlohmann/json/pull/1257
22567 template<typename... Args>
22568 iterator insert_iterator(const_iterator pos, Args&& ... args)
22569 {
22570 iterator result(this);
22571 JSON_ASSERT(m_data.m_value.array != nullptr);
22572
22573 auto insert_pos = std::distance(m_data.m_value.array->begin(), pos.m_it.array_iterator);
22574 m_data.m_value.array->insert(pos.m_it.array_iterator, std::forward<Args>(args)...);
22575 result.m_it.array_iterator = m_data.m_value.array->begin() + insert_pos;
22576
22577 // This could have been written as:
22578 // result.m_it.array_iterator = m_data.m_value.array->insert(pos.m_it.array_iterator, cnt, val);
22579 // but the return value of insert is missing in GCC 4.8, so it is written this way instead.
22580
22581 set_parents();
22582 return result;
22583 }
22584
22585 /// @brief inserts element into array
22586 /// @sa https://json.nlohmann.me/api/basic_json/insert/

Callers 1

insertFunction · 0.85

Calls 2

set_parentsFunction · 0.85
beginMethod · 0.45

Tested by

no test coverage detected