MCPcopy Create free account
hub / github.com/PeterFWS/Structure-PLP-SLAM / emplace_back

Function emplace_back

3rd/json/include/nlohmann/json.hpp:17715–17733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17713 */
17714 template<class... Args>
17715 void emplace_back(Args&& ... args)
17716 {
17717 // emplace_back only works for null objects or arrays
17718 if (JSON_UNLIKELY(not(is_null() or is_array())))
17719 {
17720 JSON_THROW(type_error::create(311, "cannot use emplace_back() with " + std::string(type_name())));
17721 }
17722
17723 // transform null object into an array
17724 if (is_null())
17725 {
17726 m_type = value_t::array;
17727 m_value = value_t::array;
17728 assert_invariant();
17729 }
17730
17731 // add element to array (perfect forwarding)
17732 m_value.array->emplace_back(std::forward<Args>(args)...);
17733 }
17734
17735 /*!
17736 @brief add an object to an object if key does not exist

Callers

nothing calls this directly

Calls 5

is_nullFunction · 0.85
is_arrayFunction · 0.85
type_nameFunction · 0.85
assert_invariantFunction · 0.85
createFunction · 0.70

Tested by

no test coverage detected