Update documentation of visit_by_index

This commit is contained in:
Peter Dimov
2021-09-15 02:00:33 +03:00
parent 8fd9f830a9
commit aebcb9792d

View File

@ -151,8 +151,8 @@ template<class R = /*unspecified*/, class F, class... V>
// visit_by_index (extension)
template<class V, class... F>
void visit_by_index(V&& v, F&&.. f);
template<class R = /*unspecified*/, class V, class... F>
constexpr /*see below*/ visit_by_index(V&& v, F&&.. f);
// monostate
@ -899,16 +899,20 @@ Remarks: :: If `R` is given explicitly, as in `visit<int>`, the return
### visit_by_index (extension)
```
template<class V, class... F>
void visit_by_index(V&& v, F&&.. f);
template<class R = /*unspecified*/, class V, class... F>
constexpr /*see below*/ visit_by_index(V&& v, F&&.. f);
```
[none]
* {blank}
+
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...`
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