|
295 | 295 | template<class Fn, class... ArgTypes> struct is_nothrow_invocable;
|
296 | 296 | template<class R, class Fn, class... ArgTypes> struct is_nothrow_invocable_r;
|
297 | 297 |
|
| 298 | + template<class Fn, class Tuple> struct is_applicable; |
| 299 | + template<class Fn, class Tuple> struct is_nothrow_applicable; |
| 300 | + |
298 | 301 | // \ref{meta.trans.cv}, const-volatile modifications
|
299 | 302 | template<class T> struct remove_const;
|
300 | 303 | template<class T> struct remove_volatile;
|
|
367 | 370 | template<class... T> struct common_reference;
|
368 | 371 | template<class T> struct underlying_type;
|
369 | 372 | template<class Fn, class... ArgTypes> struct invoke_result;
|
| 373 | + template<class Fn, class Tuple> struct apply_result; |
370 | 374 | template<class T> struct unwrap_reference;
|
371 | 375 | template<class T> struct unwrap_ref_decay;
|
372 | 376 |
|
|
388 | 392 | using @\libglobal{underlying_type_t}@ = typename underlying_type<T>::type;
|
389 | 393 | template<class Fn, class... ArgTypes>
|
390 | 394 | using @\libglobal{invoke_result_t}@ = typename invoke_result<Fn, ArgTypes...>::type;
|
| 395 | + template<class Fn, class Tuple> |
| 396 | + using @\libglobal{apply_result_t}@ = typename apply_result<Fn, Tuple>::type; |
391 | 397 | template<class T>
|
392 | 398 | using unwrap_reference_t = typename unwrap_reference<T>::type;
|
393 | 399 | template<class T>
|
|
598 | 604 | template<class R, class Fn, class... ArgTypes>
|
599 | 605 | constexpr bool is_nothrow_invocable_r_v
|
600 | 606 | = is_nothrow_invocable_r<R, Fn, ArgTypes...>::value;
|
| 607 | + template<class Fn, class Tuple> |
| 608 | + constexpr bool @\libglobal{is_applicable_v}@ = is_applicable<Fn, Tuple>::value; |
| 609 | + template<class Fn, class Tuple> |
| 610 | + constexpr bool @\libglobal{is_nothrow_applicable_v}@ = is_nothrow_applicable<Fn, Tuple>::value; |
601 | 611 |
|
602 | 612 | // \ref{meta.logical}, logical operator traits
|
603 | 613 | template<class... B>
|
|
920 | 930 | \tcode{true_type} if the corresponding condition is \tcode{true}, otherwise
|
921 | 931 | \tcode{false_type}.
|
922 | 932 |
|
| 933 | +\pnum |
| 934 | +Let \tcode{\placeholdernc{ELEMS-OF}(T)} be the parameter pack |
| 935 | +\tcode{get<\exposid{N}>(declval<T>())}, where \exposid{N} is the pack of |
| 936 | +\tcode{size_t} template arguments of the specialization of |
| 937 | +\tcode{index_sequence} denoted by |
| 938 | +\tcode{make_index_sequence<tuple_size_v<remove_reference_t<T>>>}. |
| 939 | + |
923 | 940 | \rSec3[meta.unary.cat]{Primary type categories}
|
924 | 941 |
|
925 | 942 | \pnum
|
|
1879 | 1896 | is known not to throw any exceptions\iref{expr.unary.noexcept} &
|
1880 | 1897 | \tcode{Fn}, \tcode{R}, and all types in the template parameter pack \tcode{ArgTypes}
|
1881 | 1898 | shall be complete types, \cv{}~\keyword{void}, or
|
| 1899 | + arrays of unknown bound. \\ \rowsep |
| 1900 | + |
| 1901 | +\indexlibraryglobal{is_applicable}% |
| 1902 | +\tcode{template<class Fn, class Tuple>}\br |
| 1903 | + \tcode{struct is_applicable;} & |
| 1904 | + \tcode{\exposconcept{tuple-like}<Tuple>} is \tcode{true} and |
| 1905 | + the expression |
| 1906 | + \tcode{\placeholdernc{INVOKE}(declval<Fn>(), \placeholdernc{ELEMS-OF}(Tuple)...)} |
| 1907 | + is well-formed when treated as an unevaluated operand. & |
| 1908 | + \tcode{Fn} and \tcode{Tuple} |
| 1909 | + shall be complete types, \cv{}~\keyword{void}, or |
| 1910 | + arrays of unknown bound. \\ \rowsep |
| 1911 | + |
| 1912 | +\indexlibraryglobal{is_nothrow_applicable}% |
| 1913 | +\tcode{template<class Fn, class Tuple>}\br |
| 1914 | + \tcode{struct is_nothrow_applicable;} & |
| 1915 | + \tcode{is_applicable_v<}\br\tcode{Fn, Tuple>} is \tcode{true} and |
| 1916 | + the expression \tcode{\placeholdernc{INVOKE}(declval<Fn>(), \placeholdernc{ELEMS-OF}(Tuple)...)} |
| 1917 | + is known not to throw any exceptions\iref{expr.unary.noexcept}. & |
| 1918 | + \tcode{Fn} and \tcode{Tuple} |
| 1919 | + shall be complete types, \cv{}~\keyword{void}, or |
1882 | 1920 | arrays of unknown bound. \\
|
1883 | 1921 | \end{libreqtab3f}
|
1884 | 1922 |
|
|
2320 | 2358 | are complete types, \cv{}~\keyword{void}, or arrays of
|
2321 | 2359 | unknown bound.\\ \rowsep
|
2322 | 2360 |
|
| 2361 | +\tcode{template<class Fn, class Tuple>}\br |
| 2362 | + \tcode{struct \libglobal{apply_result};} |
| 2363 | + & |
| 2364 | + If \tcode{\exposconcept{tuple-like}<Tuple>} is \tcode{true} |
| 2365 | + and the expression |
| 2366 | + \tcode{\placeholdernc{INVOKE}(declval<Fn>(), \placeholdernc{ELEMS-OF}(Tuple)...)}\iref{func.require} |
| 2367 | + is well-formed |
| 2368 | + when treated as an unevaluated operand\iref{term.unevaluated.operand}, |
| 2369 | + the member typedef \tcode{type} denotes the type |
| 2370 | + \tcode{decltype(\placeholdernc{INVOKE}(declval<Fn>(), \placeholdernc{ELEMS-OF}(Tuple)...))}; |
| 2371 | + otherwise, there shall be no member \tcode{type}. |
| 2372 | + Access checking is performed as if in a context unrelated to \tcode{Fn} |
| 2373 | + and \tcode{Tuple}. |
| 2374 | + Only the validity of the immediate context of the expression is considered. |
| 2375 | + \begin{note} |
| 2376 | + The compilation of the expression can result in side effects |
| 2377 | + such as the instantiation of class template specializations |
| 2378 | + and function template specializations, |
| 2379 | + the generation of implicitly-defined functions, and so on. |
| 2380 | + Such side effects are not in the ``immediate context'' |
| 2381 | + and can result in the program being ill-formed. |
| 2382 | + \end{note} |
| 2383 | + \expects |
| 2384 | + \tcode{Fn} and \tcode{Tuple} are complete types, \cv{}~\keyword{void}, |
| 2385 | + or arrays of unknown bound.\\ \rowsep |
| 2386 | + |
2323 | 2387 | \tcode{template<class T>} \tcode{struct \libglobal{unwrap_reference};}
|
2324 | 2388 | &
|
2325 | 2389 | If \tcode{T} is
|
|
0 commit comments