mirror of
https://github.com/nlohmann/json.git
synced 2026-03-15 13:41:25 +00:00
Reorganize directories (#3462)
* 🚚 move files * 🚚 rename doc folder to docs * 🚚 rename test folder to tests
This commit is contained in:
43
docs/mkdocs/docs/api/basic_json/operator=.md
Normal file
43
docs/mkdocs/docs/api/basic_json/operator=.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# <small>nlohmann::basic_json::</small>operator=
|
||||
|
||||
```cpp
|
||||
basic_json& operator=(basic_json other) noexcept (
|
||||
std::is_nothrow_move_constructible<value_t>::value &&
|
||||
std::is_nothrow_move_assignable<value_t>::value &&
|
||||
std::is_nothrow_move_constructible<json_value>::value &&
|
||||
std::is_nothrow_move_assignable<json_value>::value
|
||||
);
|
||||
```
|
||||
|
||||
Copy assignment operator. Copies a JSON value via the "copy and swap" strategy: It is expressed in terms of the copy
|
||||
constructor, destructor, and the `swap()` member function.
|
||||
|
||||
## Parameters
|
||||
|
||||
`other` (in)
|
||||
: value to copy from
|
||||
|
||||
## Complexity
|
||||
|
||||
Linear.
|
||||
|
||||
## Examples
|
||||
|
||||
??? example
|
||||
|
||||
The code below shows and example for the copy assignment. It creates a copy of value `a` which is then swapped with
|
||||
`b`. Finally, the copy of `a` (which is the null value after the swap) is destroyed.
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/basic_json__copyassignment.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/basic_json__copyassignment.output"
|
||||
```
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 1.0.0.
|
||||
Reference in New Issue
Block a user