diff --git a/doc/variant2/reference.adoc b/doc/variant2/reference.adoc index 5748989..897fbf4 100644 --- a/doc/variant2/reference.adoc +++ b/doc/variant2/reference.adoc @@ -151,8 +151,8 @@ template // visit_by_index (extension) -template - void visit_by_index(V&& v, F&&.. f); +template + constexpr /*see below*/ visit_by_index(V&& v, F&&.. f); // monostate @@ -899,16 +899,20 @@ Remarks: :: If `R` is given explicitly, as in `visit`, the return ### visit_by_index (extension) ``` -template - void visit_by_index(V&& v, F&&.. f); +template + constexpr /*see below*/ visit_by_index(V&& v, F&&.. f); ``` [none] * {blank} + Requires: :: `variant_size::value == sizeof...(F)`, or the program is ill-formed. -Effects: :: `std::forward(fi)(get(std::forward(v)))`, where +Returns: :: `std::forward(fi)(get(std::forward(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`, 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