From Jason Turner

[variant.get]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwlzirwxt/{from.md → to.md} +21 -0
tmp/tmpwlzirwxt/{from.md → to.md} RENAMED
@@ -8,10 +8,31 @@ template<class T, class... Types>
8
  *Mandates:* The type `T` occurs exactly once in `Types`.
9
 
10
  *Returns:* `true` if `index()` is equal to the zero-based index of `T`
11
  in `Types`.
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ``` cpp
14
  template<size_t I, class... Types>
15
  constexpr variant_alternative_t<I, variant<Types...>>& get(variant<Types...>& v);
16
  template<size_t I, class... Types>
17
  constexpr variant_alternative_t<I, variant<Types...>>&& get(variant<Types...>&& v);
 
8
  *Mandates:* The type `T` occurs exactly once in `Types`.
9
 
10
  *Returns:* `true` if `index()` is equal to the zero-based index of `T`
11
  in `Types`.
12
 
13
+ ``` cpp
14
+ template<size_t I, class... Types>
15
+ constexpr variant_alternative_t<I, variant<Types...>>&
16
+ GET(variant<Types...>& v); // exposition only
17
+ template<size_t I, class... Types>
18
+ constexpr variant_alternative_t<I, variant<Types...>>&&
19
+ GET(variant<Types...>&& v); // exposition only
20
+ template<size_t I, class... Types>
21
+ constexpr const variant_alternative_t<I, variant<Types...>>&
22
+ GET(const variant<Types...>& v); // exposition only
23
+ template<size_t I, class... Types>
24
+ constexpr const variant_alternative_t<I, variant<Types...>>&&
25
+ GET(const variant<Types...>&& v); // exposition only
26
+ ```
27
+
28
+ *Mandates:* `I` < `sizeof...(Types)`.
29
+
30
+ *Preconditions:* `v.index()` is `I`.
31
+
32
+ *Returns:* A reference to the object stored in the `variant`.
33
+
34
  ``` cpp
35
  template<size_t I, class... Types>
36
  constexpr variant_alternative_t<I, variant<Types...>>& get(variant<Types...>& v);
37
  template<size_t I, class... Types>
38
  constexpr variant_alternative_t<I, variant<Types...>>&& get(variant<Types...>&& v);