|
872 | 872 | \begin{codeblock}
|
873 | 873 | !is_convertible_v<U1, T1> || !is_convertible_v<U2, T2>
|
874 | 874 | \end{codeblock}
|
| 875 | +This constructor is defined as deleted if |
| 876 | +\tcode{reference_constructs_from_temporary_v<first_type, U1\&\&>} |
| 877 | +is \tcode{true} or |
| 878 | +\tcode{reference_constructs_from_temporary_v<second_type, U2\&\&>} |
| 879 | +is \tcode{true}. |
875 | 880 | \end{itemdescr}
|
876 | 881 |
|
877 | 882 | \indexlibraryctor{pair}%
|
|
909 | 914 | !is_convertible_v<decltype(get<0>(@\exposid{FWD}@(p))), T1> ||
|
910 | 915 | !is_convertible_v<decltype(get<1>(@\exposid{FWD}@(p))), T2>
|
911 | 916 | \end{codeblock}
|
| 917 | +The constructor is defined as deleted if |
| 918 | +\begin{codeblock} |
| 919 | +reference_constructs_from_temporary_v<first_type, decltype(get<0>(@\exposid{FWD}@(p)))> || |
| 920 | +reference_constructs_from_temporary_v<second_type, decltype(get<1>(@\exposid{FWD}@(p)))> |
| 921 | +\end{codeblock} |
| 922 | +is \tcode{true}. |
912 | 923 | \end{itemdescr}
|
913 | 924 |
|
914 | 925 | \indexlibraryctor{pair}%
|
|
936 | 947 | \tcode{std::forward<U>(x)}.) This form of construction, whereby constructor
|
937 | 948 | arguments for \tcode{first} and \tcode{second} are each provided in a separate
|
938 | 949 | \tcode{tuple} object, is called \defn{piecewise construction}.
|
| 950 | +\begin{note} |
| 951 | +If a data member of \tcode{pair} is of reference type and |
| 952 | +its initialization binds it to a temporary object, |
| 953 | +the program is ill-formed\iref{class.base.init}. |
| 954 | +\end{note} |
939 | 955 | \end{itemdescr}
|
940 | 956 |
|
941 | 957 | \indexlibrarymember{operator=}{pair}%
|
|
1731 | 1747 | \begin{codeblock}
|
1732 | 1748 | !conjunction_v<is_convertible<UTypes, Types>...>
|
1733 | 1749 | \end{codeblock}
|
| 1750 | +This constructor is defined as deleted if |
| 1751 | +\begin{codeblock} |
| 1752 | +(reference_constructs_from_temporary_v<Types, UTypes\&\&> || ...) |
| 1753 | +\end{codeblock} |
| 1754 | +is \tcode{true}. |
1734 | 1755 | \end{itemdescr}
|
1735 | 1756 |
|
1736 | 1757 | \indexlibraryctor{tuple}%
|
|
1806 | 1827 | \begin{codeblock}
|
1807 | 1828 | !(is_convertible_v<decltype(get<I>(@\exposid{FWD}@(u))), Types> && ...)
|
1808 | 1829 | \end{codeblock}
|
| 1830 | +The constructor is defined as deleted if |
| 1831 | +\begin{codeblock} |
| 1832 | +(reference_constructs_from_temporary_v<Types, decltype(get<I>(@\exposid{FWD}@(u)))> || ...) |
| 1833 | +\end{codeblock} |
| 1834 | +is \tcode{true}. |
1809 | 1835 | \end{itemdescr}
|
1810 | 1836 |
|
1811 | 1837 | \indexlibraryctor{tuple}%
|
|
1843 | 1869 | !is_convertible_v<decltype(get<0>(@\exposid{FWD}@(u))), @$\tcode{T}_0$@> ||
|
1844 | 1870 | !is_convertible_v<decltype(get<1>(@\exposid{FWD}@(u))), @$\tcode{T}_1$@>
|
1845 | 1871 | \end{codeblock}
|
| 1872 | +The constructor is defined as deleted if |
| 1873 | +\begin{codeblock} |
| 1874 | +reference_constructs_from_temporary_v<@$\tcode{T}_0$@, decltype(get<0>(@\exposid{FWD}@(u)))> || |
| 1875 | +reference_constructs_from_temporary_v<@$\tcode{T}_1$@, decltype(get<1>(@\exposid{FWD}@(u)))> |
| 1876 | +\end{codeblock} |
| 1877 | +is \tcode{true}. |
1846 | 1878 | \end{itemdescr}
|
1847 | 1879 |
|
1848 | 1880 | \indexlibraryctor{tuple}%
|
|
2404 | 2436 | \end{itemdecl}
|
2405 | 2437 |
|
2406 | 2438 | \begin{itemdescr}
|
| 2439 | +\pnum |
| 2440 | +\mandates |
| 2441 | +If \tcode{tuple_size_v<remove_reference_t<Tuple>>} is 1, |
| 2442 | +then |
| 2443 | +\tcode{reference_constructs_from_temporary_v<T, decltype(get<0>(declval<Tuple>()))>} |
| 2444 | +is \tcode{false}. |
| 2445 | + |
2407 | 2446 | \pnum
|
2408 | 2447 | \effects
|
2409 | 2448 | Given the exposition-only function:
|
|
16393 | 16432 | if \tcode{R} is \cv{}~\keyword{void}, otherwise
|
16394 | 16433 | \tcode{\placeholdernc{INVOKE}(f, t$_1$, t$_2$, $\dotsc$, t$_N$)} implicitly converted
|
16395 | 16434 | to \tcode{R}.
|
| 16435 | +If |
| 16436 | +\tcode{reference_converts_from_temporary_v<R, decltype(\placeholdernc{INVOKE}(f, t$_1$, t$_2$, $\dotsc$, t$_N$))>} |
| 16437 | +is \tcode{true}, |
| 16438 | +\tcode{\placeholdernc{INVOKE}<R>(f, t$_1$, t$_2$, $\dotsc$, t$_N$)} |
| 16439 | +is ill-formed. |
16396 | 16440 |
|
16397 | 16441 | \pnum
|
16398 | 16442 | \indextext{call wrapper}%
|
|
19554 | 19598 |
|
19555 | 19599 | template<class T> struct has_unique_object_representations;
|
19556 | 19600 |
|
| 19601 | + template<class T, class U> struct reference_constructs_from_temporary; |
| 19602 | + template<class T, class U> struct reference_converts_from_temporary; |
| 19603 | + |
19557 | 19604 | // \ref{meta.unary.prop.query}, type property queries
|
19558 | 19605 | template<class T> struct alignment_of;
|
19559 | 19606 | template<class T> struct rank;
|
|
19826 | 19873 | template<class T>
|
19827 | 19874 | inline constexpr bool has_unique_object_representations_v
|
19828 | 19875 | = has_unique_object_representations<T>::value;
|
| 19876 | + template<class T, class U> |
| 19877 | + inline constexpr bool @\libglobal{reference_constructs_from_temporary_v}@ |
| 19878 | + = reference_constructs_from_temporary<T, U>::value; |
| 19879 | + template<class T, class U> |
| 19880 | + inline constexpr bool @\libglobal{reference_converts_from_temporary_v}@ |
| 19881 | + = reference_converts_from_temporary<T, U>::value; |
19829 | 19882 |
|
19830 | 19883 | // \ref{meta.unary.prop.query}, type property queries
|
19831 | 19884 | template<class T>
|
|
20081 | 20134 | in the context of the corresponding definition
|
20082 | 20135 | notwithstanding the restrictions of~\ref{declval}.
|
20083 | 20136 |
|
| 20137 | +\pnum |
| 20138 | +For the purpose of defining the templates in this subclause, |
| 20139 | +let \tcode{\placeholdernc{VAL}<T>} for some type \tcode{T} be |
| 20140 | +an expression defined as follows: |
| 20141 | +\begin{itemize} |
| 20142 | +\item |
| 20143 | +If \tcode{T} is a reference or function type, |
| 20144 | +\tcode{\placeholdernc{VAL}<T>} is an expression |
| 20145 | +with the same type and value category as \tcode{declval<T>()}. |
| 20146 | +\item |
| 20147 | +Otherwise, \tcode{\placeholdernc{VAL}<T>} is a prvalue |
| 20148 | +that initially has type \tcode{T}. |
| 20149 | +\begin{note} |
| 20150 | +If \tcode{T} is cv-qualified, |
| 20151 | +the cv-qualification is subject to adjustment\iref{expr.type}. |
| 20152 | +\end{note} |
| 20153 | +\end{itemize} |
| 20154 | + |
20084 | 20155 | \begin{libreqtab3b}{Type property predicates}{meta.unary.prop}
|
20085 | 20156 | \\ \topline
|
20086 | 20157 | \lhdr{Template} & \chdr{Condition} & \rhdr{Preconditions} \\ \capsep
|
|
20492 | 20563 | \tcode{T} shall be a complete type, \cv{}~\keyword{void}, or
|
20493 | 20564 | an array of unknown bound. \\ \rowsep
|
20494 | 20565 |
|
| 20566 | +\indexlibraryglobal{reference_constructs_from_temporary}% |
| 20567 | +\tcode{template<class T, class U>}\br |
| 20568 | + \tcode{struct reference_constructs_from_temporary;} & |
| 20569 | + \tcode{conjunction_v<is_reference<T>, is_constructible<T, U>>} |
| 20570 | + is \tcode{true}, and |
| 20571 | + the initialization \tcode{T t(\exposidnc{VAL}<U>);} binds \tcode{t} to |
| 20572 | + a temporary object whose lifetime is extended\iref{class.temporary}. & |
| 20573 | + \tcode{T} and \tcode{U} shall be |
| 20574 | + complete types, \cv{}~\keyword{void}, or arrays of unknown bound. \\ \rowsep |
| 20575 | + |
| 20576 | +\indexlibraryglobal{reference_converts_from_temporary}% |
| 20577 | +\tcode{template<class T, class U>}\br |
| 20578 | + \tcode{struct reference_converts_from_temporary;} & |
| 20579 | + \tcode{conjunction_v<is_reference<T>, is_convertible<U, T>>} is \tcode{true}, |
| 20580 | + and the initialization \tcode{T t = \exposidnc{VAL}<U>;} binds \tcode{t} to |
| 20581 | + a temporary object whose lifetime is extended\iref{class.temporary}. & |
| 20582 | + \tcode{T} and \tcode{U} shall be |
| 20583 | + complete types, \cv{}~\keyword{void}, or arrays of unknown bound. \\ \rowsep |
| 20584 | + |
20495 | 20585 | \end{libreqtab3b}
|
20496 | 20586 |
|
20497 | 20587 | \pnum
|
|
0 commit comments