From Jason Turner

[variant.visit]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp15o96yx1/{from.md → to.md} +26 -0
tmp/tmp15o96yx1/{from.md → to.md} RENAMED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Visitation <a id="variant.visit">[[variant.visit]]</a>
2
+
3
+ ``` cpp
4
+ template <class Visitor, class... Variants>
5
+ constexpr see below visit(Visitor&& vis, Variants&&... vars);
6
+ ```
7
+
8
+ *Requires:* The expression in the *Effects:* element shall be a valid
9
+ expression of the same type and value category, for all combinations of
10
+ alternative types of all variants. Otherwise, the program is ill-formed.
11
+
12
+ *Effects:* Let `is...` be `vars.index()...`. Returns
13
+ *INVOKE*(forward\<Visitor\>(vis), get\<is\>(
14
+ `forward<Variants>(vars))...);`.
15
+
16
+ *Remarks:* The return type is the common type of all possible *`INVOKE`*
17
+ expressions of the *Effects:* element.
18
+
19
+ *Throws:* `bad_variant_access` if any `variant` in `vars` is
20
+ `valueless_by_exception()`.
21
+
22
+ *Complexity:* For `sizeof...(Variants) <= 1`, the invocation of the
23
+ callable object is implemented in constant time, i.e. it does not depend
24
+ on `sizeof...(Types).` For `sizeof...(Variants) > 1`, the invocation of
25
+ the callable object has no complexity requirements.
26
+