swap
Swap two objects.
Synopsis
Defined in header <boost/json/object.hpp>.
Description
Exchanges the contents of the object lhs with another object rhs. Ownership of the respective boost::container::pmr::memory_resource objects is not transferred. If &lhs == &rhs, this function call has no effect.
- 
If
*lhs.storage() == *rhs.storage()all iterators and references remain valid. - 
Otherwise, the contents are logically swapped by making copies, which can throw. In this case all iterators and references are invalidated.
 
Complexity
If *lhs.storage() == *rhs.storage(), then constant; otherwise linear in lhs.size() + rhs.size().
Exception Safety
No-throw guarantee if *lhs.storage() == *rhs.storage(). Otherwise strong guarantee. Calls to memory_resource::allocate may throw.
Parameters
| Name | Description | 
|---|---|
  | 
The object to exchange.  | 
  | 
The object to exchange.  | 
See Also
Convenience header <boost/json.hpp>