From Jason Turner

[variant.mod]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3pkgkxbq/{from.md → to.md} +76 -0
tmp/tmp3pkgkxbq/{from.md → to.md} RENAMED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Modifiers <a id="variant.mod">[[variant.mod]]</a>
2
+
3
+ ``` cpp
4
+ template <class T, class... Args> T& emplace(Args&&... args);
5
+ ```
6
+
7
+ Let I be the zero-based index of `T` in `Types...`.
8
+
9
+ *Effects:* Equivalent to:
10
+ `return emplace<`I`>(std::forward<Args>(args)...);`
11
+
12
+ *Remarks:* This function shall not participate in overload resolution
13
+ unless `is_constructible_v<T, Args...>` is `true`, and `T` occurs
14
+ exactly once in `Types...`.
15
+
16
+ ``` cpp
17
+ template <class T, class U, class... Args> T& emplace(initializer_list<U> il, Args&&... args);
18
+ ```
19
+
20
+ Let I be the zero-based index of `T` in `Types...`.
21
+
22
+ *Effects:* Equivalent to:
23
+ `return emplace<`I`>(il, std::forward<Args>(args)...);`
24
+
25
+ *Remarks:* This function shall not participate in overload resolution
26
+ unless `is_constructible_v<T, initializer_list<U>&, Args...>` is `true`,
27
+ and `T` occurs exactly once in `Types...`.
28
+
29
+ ``` cpp
30
+ template <size_t I, class... Args>
31
+ variant_alternative_t<I, variant<Types...>>& emplace(Args&&... args);
32
+ ```
33
+
34
+ *Requires:* `I < sizeof...(Types)`.
35
+
36
+ *Effects:* Destroys the currently contained value if
37
+ `valueless_by_exception()` is `false`. Then initializes the contained
38
+ value as if direct-non-list-initializing a value of type `T_I` with the
39
+ arguments `std::forward<Args>(args)...`.
40
+
41
+ *Postconditions:* `index()` is `I`.
42
+
43
+ *Returns:* A reference to the new contained value.
44
+
45
+ *Throws:* Any exception thrown during the initialization of the
46
+ contained value.
47
+
48
+ *Remarks:* This function shall not participate in overload resolution
49
+ unless `is_constructible_v<``T_I``, Args...>` is `true`. If an exception
50
+ is thrown during the initialization of the contained value, the
51
+ `variant` might not hold a value.
52
+
53
+ ``` cpp
54
+ template <size_t I, class U, class... Args>
55
+ variant_alternative_t<I, variant<Types...>>& emplace(initializer_list<U> il, Args&&... args);
56
+ ```
57
+
58
+ *Requires:* `I < sizeof...(Types)`.
59
+
60
+ *Effects:* Destroys the currently contained value if
61
+ `valueless_by_exception()` is `false`. Then initializes the contained
62
+ value as if direct-non-list-initializing a value of type `T_I` with the
63
+ arguments `il, std::forward<Args>(args)...`.
64
+
65
+ *Postconditions:* `index()` is `I`.
66
+
67
+ *Returns:* A reference to the new contained value.
68
+
69
+ *Throws:* Any exception thrown during the initialization of the
70
+ contained value.
71
+
72
+ *Remarks:* This function shall not participate in overload resolution
73
+ unless `is_constructible_v<``T_I``, initializer_list<U>&, Args...>` is
74
+ `true`. If an exception is thrown during the initialization of the
75
+ contained value, the `variant` might not hold a value.
76
+