• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# basic_json::operator=
2
3```cpp
4basic_json& operator=(basic_json other) noexcept (
5    std::is_nothrow_move_constructible<value_t>::value &&
6    std::is_nothrow_move_assignable<value_t>::value &&
7    std::is_nothrow_move_constructible<json_value>::value &&
8    std::is_nothrow_move_assignable<json_value>::value
9);
10```
11
12Copy assignment operator. Copies a JSON value via the "copy and swap" strategy: It is expressed in terms of the copy
13constructor, destructor, and the `swap()` member function.
14
15## Parameters
16
17`other` (in)
18:   value to copy from
19
20## Complexity
21
22Linear.
23
24## Example
25
26??? example
27
28    The code below shows and example for the copy assignment. It creates a copy of value `a` which is then swapped with
29    `b`. Finally, the copy of `a` (which is the null value after the swap) is destroyed.
30
31    ```cpp
32    --8<-- "examples/basic_json__copyassignment.cpp"
33    ```
34
35    Output:
36
37    ```json
38    --8<-- "examples/basic_json__copyassignment.output"
39    ```
40
41## Version history
42
43- Added in version 1.0.0.
44