forked from boostorg/variant2
Update documentation of visit_by_index
This commit is contained in:
@ -151,8 +151,8 @@ template<class R = /*unspecified*/, class F, class... V>
|
|||||||
|
|
||||||
// visit_by_index (extension)
|
// visit_by_index (extension)
|
||||||
|
|
||||||
template<class V, class... F>
|
template<class R = /*unspecified*/, class V, class... F>
|
||||||
void visit_by_index(V&& v, F&&.. f);
|
constexpr /*see below*/ visit_by_index(V&& v, F&&.. f);
|
||||||
|
|
||||||
// monostate
|
// monostate
|
||||||
|
|
||||||
@ -899,16 +899,20 @@ Remarks: :: If `R` is given explicitly, as in `visit<int>`, the return
|
|||||||
### visit_by_index (extension)
|
### visit_by_index (extension)
|
||||||
|
|
||||||
```
|
```
|
||||||
template<class V, class... F>
|
template<class R = /*unspecified*/, class V, class... F>
|
||||||
void visit_by_index(V&& v, F&&.. f);
|
constexpr /*see below*/ visit_by_index(V&& v, F&&.. f);
|
||||||
```
|
```
|
||||||
[none]
|
[none]
|
||||||
* {blank}
|
* {blank}
|
||||||
+
|
+
|
||||||
Requires: :: `variant_size<V>::value == sizeof...(F)`, or the program is ill-formed.
|
Requires: :: `variant_size<V>::value == sizeof...(F)`, or the program is ill-formed.
|
||||||
Effects: :: `std::forward<Fi>(fi)(get<i>(std::forward<V>(v)))`, where
|
Returns: :: `std::forward<Fi>(fi)(get<i>(std::forward<V>(v)))`, where
|
||||||
`i` is `v.index()` and `Fi` and `fi` are the `i`-th element of `F...` and `f...`
|
`i` is `v.index()` and `Fi` and `fi` are the `i`-th element of `F...` and `f...`
|
||||||
accordingly.
|
accordingly.
|
||||||
|
Remarks: :: If `R` is given explicitly, as in `visit_by_index<int>`, the return
|
||||||
|
type is `R`. Otherwise, it's deduced from `F...` and `V`. All the applications
|
||||||
|
of `Fi` to the corresponding variant alternatives must have the same return type
|
||||||
|
for this deduction to succeed.
|
||||||
|
|
||||||
### swap
|
### swap
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user