@exceptionsafety Depends on the called constructor. For types directly supported by the library (i.e., all types for which no to_json()
function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any JSON value.
19299 {
19300 using other_boolean_t = typename BasicJsonType::boolean_t;
19301 using other_number_float_t = typename BasicJsonType::number_float_t;
19302 using other_number_integer_t = typename BasicJsonType::number_integer_t;
19303 using other_number_unsigned_t = typename BasicJsonType::number_unsigned_t;
19304 using other_string_t = typename BasicJsonType::string_t;
19305 using other_object_t = typename BasicJsonType::object_t;
19306 using other_array_t = typename BasicJsonType::array_t;
19307 using other_binary_t = typename BasicJsonType::binary_t;
19308
19309 switch (val.type())
19310 {
19312 JSONSerializer<other_boolean_t>::to_json(*this, val.template get<other_boolean_t>());
19313 break;
19314
19316 JSONSerializer<other_number_float_t>::to_json(*this, val.template get<other_number_float_t>());
19317 break;
19318
19320 JSONSerializer<other_number_integer_t>::to_json(*this, val.template get<other_number_integer_t>());
19321 break;
19322
19324 JSONSerializer<other_number_unsigned_t>::to_json(*this, val.template get<other_number_unsigned_t>());
19325 break;
19326
19328 JSONSerializer<other_string_t>::to_json(*this, val.template get_ref<const other_string_t &>());
19329 break;
19330
19332 JSONSerializer<other_object_t>::to_json(*this, val.template get_ref<const other_object_t &>());
19333 break;
19334
19336 JSONSerializer<other_array_t>::to_json(*this, val.template get_ref<const other_array_t &>());
19337 break;
19338
19340 JSONSerializer<other_binary_t>::to_json(*this, val.template get_ref<const other_binary_t &>());
19341 break;
19342
19344 *this = nullptr;
19345 break;
19346
19349 break;
19350
19351 default:
19352 JSON_ASSERT(false);
19353 }
19354
19355 set_parents();
19357 }
void assert_invariant(bool check_parents=true) const noexcept
checks the class invariants
@ number_integer
number value (signed integer)
@ discarded
discarded by the parser callback function
@ binary
binary array (ordered collection of bytes)
@ object
object (unordered set of name/value pairs)
@ number_float
number value (floating-point)
@ number_unsigned
number value (unsigned integer)
@ array
array (ordered collection of values)