|
276 | 276 | template<class Fn, class... ArgTypes> struct is_nothrow_invocable;
|
277 | 277 | template<class R, class Fn, class... ArgTypes> struct is_nothrow_invocable_r;
|
278 | 278 |
|
| 279 | + template<class Fn, class Tuple> struct is_applicable; |
| 280 | + template<class Fn, class Tuple> struct is_nothrow_applicable; |
| 281 | + |
279 | 282 | // \ref{meta.trans.cv}, const-volatile modifications
|
280 | 283 | template<class T> struct remove_const;
|
281 | 284 | template<class T> struct remove_volatile;
|
|
348 | 351 | template<class... T> struct common_reference;
|
349 | 352 | template<class T> struct underlying_type;
|
350 | 353 | template<class Fn, class... ArgTypes> struct invoke_result;
|
| 354 | + template<class Fn, class Tuple> struct apply_result; |
351 | 355 | template<class T> struct unwrap_reference;
|
352 | 356 | template<class T> struct unwrap_ref_decay;
|
353 | 357 |
|
|
369 | 373 | using @\libglobal{underlying_type_t}@ = typename underlying_type<T>::type;
|
370 | 374 | template<class Fn, class... ArgTypes>
|
371 | 375 | using @\libglobal{invoke_result_t}@ = typename invoke_result<Fn, ArgTypes...>::type;
|
| 376 | + template<class Fn, class Tuple> |
| 377 | + using @\libglobal{apply_result_t}@ = typename apply_result<Fn, Tuple>::type; |
372 | 378 | template<class T>
|
373 | 379 | using unwrap_reference_t = typename unwrap_reference<T>::type;
|
374 | 380 | template<class T>
|
|
575 | 581 | template<class R, class Fn, class... ArgTypes>
|
576 | 582 | constexpr bool is_nothrow_invocable_r_v
|
577 | 583 | = is_nothrow_invocable_r<R, Fn, ArgTypes...>::value;
|
| 584 | + template<class Fn, class Tuple> |
| 585 | + constexpr bool @\libglobal{is_applicable_v}@ = is_applicable<Fn, Tuple>::value; |
| 586 | + template<class Fn, class Tuple> |
| 587 | + constexpr bool @\libglobal{is_nothrow_applicable_v}@ |
| 588 | + = is_nothrow_applicable<Fn, Tuple>::value; |
578 | 589 |
|
579 | 590 | // \ref{meta.logical}, logical operator traits
|
580 | 591 | template<class... B>
|
|
639 | 650 | \tcode{true_type} if the corresponding condition is \tcode{true}, otherwise
|
640 | 651 | \tcode{false_type}.
|
641 | 652 |
|
| 653 | +\pnum |
| 654 | +Let \tcode{\placeholdernc{ELEMS-OF}(T)} be the parameter pack |
| 655 | +\tcode{get<\exposid{N}>(declval<T>())}, where \exposid{N} is the pack of |
| 656 | +\tcode{size_t} template arguments of the specialization of |
| 657 | +\tcode{index_sequence} denoted by |
| 658 | +\tcode{make_index_sequence<tuple_size_v<remove_reference_t<T>>>}. |
| 659 | + |
642 | 660 | \rSec3[meta.unary.cat]{Primary type categories}
|
643 | 661 |
|
644 | 662 | \pnum
|
|
1588 | 1606 | is known not to throw any exceptions\iref{expr.unary.noexcept} &
|
1589 | 1607 | \tcode{Fn}, \tcode{R}, and all types in the template parameter pack \tcode{ArgTypes}
|
1590 | 1608 | shall be complete types, \cv{}~\keyword{void}, or
|
| 1609 | + arrays of unknown bound. \\ \rowsep |
| 1610 | + |
| 1611 | +\indexlibraryglobal{is_applicable}% |
| 1612 | +\tcode{template<class Fn, class Tuple>}\br |
| 1613 | + \tcode{struct is_applicable;} & |
| 1614 | + \tcode{\exposconcept{tuple-like}<Tuple>} is \tcode{true} and |
| 1615 | + the expression |
| 1616 | + \tcode{\placeholdernc{INVOKE}(declval<Fn>(), \placeholdernc{ELEMS-OF}(Tuple)...)} |
| 1617 | + is well-formed when treated as an unevaluated operand. & |
| 1618 | + \tcode{Fn} and \tcode{Tuple} |
| 1619 | + shall be complete types, \cv{}~\keyword{void}, or |
| 1620 | + arrays of unknown bound. \\ \rowsep |
| 1621 | + |
| 1622 | +\indexlibraryglobal{is_nothrow_applicable}% |
| 1623 | +\tcode{template<class Fn, class Tuple>}\br |
| 1624 | + \tcode{struct is_nothrow_applicable;} & |
| 1625 | + \tcode{is_applicable_v<}\br\tcode{Fn, Tuple>} is \tcode{true} and |
| 1626 | + the expression \tcode{\placeholdernc{INVOKE}(declval<Fn>(), \placeholdernc{ELEMS-OF}(Tuple)...)} |
| 1627 | + is known not to throw any exceptions\iref{expr.unary.noexcept} & |
| 1628 | + \tcode{Fn} and \tcode{Tuple} |
| 1629 | + shall be complete types, \cv{}~\keyword{void}, or |
1591 | 1630 | arrays of unknown bound. \\
|
1592 | 1631 | \end{libreqtab3f}
|
1593 | 1632 |
|
|
2029 | 2068 | are complete types, \cv{}~\keyword{void}, or arrays of
|
2030 | 2069 | unknown bound.\\ \rowsep
|
2031 | 2070 |
|
| 2071 | +\tcode{template<class Fn, class Tuple>}\br |
| 2072 | + \tcode{struct \libglobal{apply_result};} |
| 2073 | + & |
| 2074 | + If \tcode{\exposconcept{tuple-like}<Tuple>} is \tcode{true} |
| 2075 | + and the expression |
| 2076 | + \tcode{\placeholdernc{INVOKE}(declval<Fn>(), \placeholdernc{ELEMS-OF}(Tuple)...)}\iref{func.require} |
| 2077 | + is well-formed |
| 2078 | + when treated as an unevaluated operand\iref{term.unevaluated.operand}, |
| 2079 | + the member typedef \tcode{type} denotes the type |
| 2080 | + \tcode{decltype(\placeholdernc{INVOKE}(declval<Fn>(), \placeholdernc{ELEMS-OF}(Tuple)...))}; |
| 2081 | + otherwise, there shall be no member \tcode{type}. |
| 2082 | + Access checking is performed as if in a context unrelated to \tcode{Fn} |
| 2083 | + and \tcode{Tuple}. |
| 2084 | + Only the validity of the immediate context of the expression is considered. |
| 2085 | + \begin{note} |
| 2086 | + The compilation of the expression can result in side effects |
| 2087 | + such as the instantiation of class template specializations |
| 2088 | + and function template specializations, |
| 2089 | + the generation of implicitly-defined functions, and so on. |
| 2090 | + Such side effects are not in the ``immediate context'' |
| 2091 | + and can result in the program being ill-formed. |
| 2092 | + \end{note} |
| 2093 | + \expects |
| 2094 | + \tcode{Fn} and \tcode{Tuple} are complete types, \cv{}~\keyword{void}, |
| 2095 | + or arrays of unknown bound.\\ \rowsep |
| 2096 | + |
2032 | 2097 | \tcode{template<class T>} \tcode{struct \libglobal{unwrap_reference};}
|
2033 | 2098 | &
|
2034 | 2099 | If \tcode{T} is
|
|
0 commit comments