TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ set_parent()

template<template< typename U, typename V, typename... Args > class ObjectType = std::map, template< typename U, typename... Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator, template< typename T, typename SFINAE=void > class JSONSerializer = adl_serializer, class BinaryType = std::vector<std::uint8_t>>
reference nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::set_parent ( reference  j,
std::size_t  old_capacity = std::size_t(-1) 
)
inlineprivate

Definition at line 19011 of file json.hpp.

19012 {
19013#if JSON_DIAGNOSTICS
19014
19015 if (old_capacity != std::size_t(-1))
19016 {
19017 // see https://github.com/nlohmann/json/issues/2838
19018 JSON_ASSERT(type() == value_t::array);
19019
19020 if (JSON_HEDLEY_UNLIKELY(m_value.array->capacity() != old_capacity))
19021 {
19022 // capacity has changed: update all parents
19023 set_parents();
19024 return j;
19025 }
19026 }
19027
19028 // ordered_json uses a vector internally, so pointers could have
19029 // been invalidated; see https://github.com/nlohmann/json/issues/2962
19030#ifdef JSON_HEDLEY_MSVC_VERSION
19031#pragma warning(push )
19032#pragma warning(disable : 4127) // ignore warning to replace if with if constexpr
19033#endif
19034
19035 if (detail::is_ordered_map<object_t>::value)
19036 {
19037 set_parents();
19038 return j;
19039 }
19040
19041#ifdef JSON_HEDLEY_MSVC_VERSION
19042#pragma warning( pop )
19043#endif
19044 j.m_parent = this;
19045#else
19046 static_cast<void>(j);
19047 static_cast<void>(old_capacity);
19048#endif
19049 return j;
19050 }
constexpr value_t type() const noexcept
return the type of the JSON value (explicit)
Definition: json.hpp:20171
json_value m_value
the value of the current element
Definition: json.hpp:24928
@ array
array (ordered collection of values)