From Jason Turner

[any.modifiers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp54rxrz0j/{from.md → to.md} +66 -0
tmp/tmp54rxrz0j/{from.md → to.md} RENAMED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Modifiers <a id="any.modifiers">[[any.modifiers]]</a>
2
+
3
+ ``` cpp
4
+ template <class T, class... Args>
5
+ decay_t<T>& emplace(Args&&... args);
6
+ ```
7
+
8
+ Let `VT` be `decay_t<T>`.
9
+
10
+ *Requires:* `VT` shall satisfy the `CopyConstructible` requirements.
11
+
12
+ *Effects:* Calls `reset()`. Then initializes the contained value as if
13
+ direct-non-list-initializing an object of type `VT` with the arguments
14
+ `std::forward<Args>(args)...`.
15
+
16
+ *Postconditions:* `*this` contains a value.
17
+
18
+ *Returns:* A reference to the new contained value.
19
+
20
+ *Throws:* Any exception thrown by the selected constructor of `VT`.
21
+
22
+ *Remarks:* If an exception is thrown during the call to `VT`’s
23
+ constructor, `*this` does not contain a value, and any previously
24
+ contained value has been destroyed. This function shall not participate
25
+ in overload resolution unless `is_copy_constructible_v<VT>` is `true`
26
+ and `is_constructible_v<VT, Args...>` is `true`.
27
+
28
+ ``` cpp
29
+ template <class T, class U, class... Args>
30
+ decay_t<T>& emplace(initializer_list<U> il, Args&&... args);
31
+ ```
32
+
33
+ Let `VT` be `decay_t<T>`.
34
+
35
+ *Requires:* `VT` shall satisfy the `CopyConstructible` requirements.
36
+
37
+ *Effects:* Calls `reset()`. Then initializes the contained value as if
38
+ direct-non-list-initializing an object of type `VT` with the arguments
39
+ `il, std::forward<Args>(args)...`.
40
+
41
+ *Postconditions:* `*this` contains a value.
42
+
43
+ *Returns:* A reference to the new contained value.
44
+
45
+ *Throws:* Any exception thrown by the selected constructor of `VT`.
46
+
47
+ *Remarks:* If an exception is thrown during the call to `VT`’s
48
+ constructor, `*this` does not contain a value, and any previously
49
+ contained value has been destroyed. The function shall not participate
50
+ in overload resolution unless `is_copy_constructible_v<VT>` is `true`
51
+ and `is_constructible_v<VT, initializer_list<U>&, Args...>` is `true`.
52
+
53
+ ``` cpp
54
+ void reset() noexcept;
55
+ ```
56
+
57
+ *Effects:* If `has_value()` is `true`, destroys the contained value.
58
+
59
+ *Postconditions:* `has_value()` is `false`.
60
+
61
+ ``` cpp
62
+ void swap(any& rhs) noexcept;
63
+ ```
64
+
65
+ *Effects:* Exchanges the states of `*this` and `rhs`.
66
+