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>>
void nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::swap |
( |
reference |
other | ) |
|
|
inlinenoexcept |
exchanges the values
Exchanges the contents of the JSON value with those of other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated.
- Parameters
-
[in,out] | other | JSON value to exchange the contents with |
@complexity Constant.
@liveexample{The example below shows how JSON values can be swapped with swap()
.,swap__reference}
- Since
- version 1.0.0
Definition at line 23802 of file json.hpp.
23808 {
23809 std::swap(m_type, other.m_type);
23810 std::swap(
m_value, other.m_value);
23811 set_parents();
23812 other.set_parents();
23814 }
void assert_invariant(bool check_parents=true) const noexcept
checks the class invariants
json_value m_value
the value of the current element