|
4838 | 4838 |
|
4839 | 4839 | \begin{itemdescr}
|
4840 | 4840 | \pnum
|
4841 |
| -\requires |
4842 |
| -The expression in the \effects element shall be a valid expression of the same |
4843 |
| - type and value category, for all combinations of alternative types of all |
4844 |
| - variants. Otherwise, the program is ill-formed. |
4845 |
| - |
4846 |
| -\pnum |
4847 |
| -\effects |
4848 |
| -Let \tcode{is...} be \tcode{vars.index()...}. Returns: |
| 4841 | +Let $n$ be \tcode{sizeof...(Variants)}. Let \tcode{m} be a pack of $n$ |
| 4842 | +values of type \tcode{size_t}. Such a pack is called valid if $0 \leq |
| 4843 | +\tcode{m}_i < \tcode{variant_size_v<remove_reference_t<Variants}_i\tcode{>>}$ for |
| 4844 | +all $0 \leq i < n$. For each valid pack $\tcode{m}$, let $e(\tcode{m})$ |
| 4845 | +denote the expression: |
4849 | 4846 | \begin{codeblock}
|
4850 |
| -@\placeholdernc{INVOKE}@(std::forward<Visitor>(vis), get<is>(std::forward<Variants>(vars))...) // see \ref{func.require} |
| 4847 | +@\placeholder{INVOKE}@(std::forward<Visitor>(vis), get<m>(std::forward<Variants>(vars))...) // see \ref{func.require} |
4851 | 4848 | \end{codeblock}
|
4852 | 4849 |
|
4853 | 4850 | \pnum
|
4854 |
| -\remarks |
4855 |
| -The return type is the common type of all possible \tcode{\placeholder{INVOKE}} |
4856 |
| -expressions of the \effects element. |
| 4851 | +\requires |
| 4852 | +For each valid pack \tcode{m}, $e(\tcode{m})$ shall be a valid expression. |
| 4853 | +All such expressions shall be of the same type and value category; |
| 4854 | +otherwise, the program is ill-formed. |
| 4855 | + |
| 4856 | +\pnum |
| 4857 | +\returns $e(\tcode{m})$, where \tcode{m} is the pack for which |
| 4858 | +$\tcode{m}_i$ is \tcode{vars$_i$.index()} for |
| 4859 | +all $0 \leq i < n$. The return type is the type of $e(\tcode{m})$. |
4857 | 4860 |
|
4858 | 4861 | \pnum
|
4859 | 4862 | \throws
|
4860 | 4863 | \tcode{bad_variant_access} if any \tcode{variant} in \tcode{vars} is \tcode{valueless_by_exception()}.
|
4861 | 4864 |
|
4862 | 4865 | \pnum
|
4863 | 4866 | \complexity
|
4864 |
| -For \tcode{sizeof...(Variants) <= 1}, the invocation of the callable object is |
4865 |
| -implemented in constant time, i.e., it does not depend on \tcode{sizeof...(Types).} |
4866 |
| -For \tcode{sizeof...(Variants) > 1}, the invocation of the callable object has |
| 4867 | +For $n \leq 1$, the invocation of the callable object is |
| 4868 | +implemented in constant time, i.e., for $n = 1$, it does not depend on |
| 4869 | +the number of alternative types of $\tcode{Variants}_0$. |
| 4870 | +For $n > 1$, the invocation of the callable object has |
4867 | 4871 | no complexity requirements.
|
4868 | 4872 | \end{itemdescr}
|
4869 | 4873 |
|
|
0 commit comments