Skip to content

Commit e645604

Browse files
authored
Merge 2019-07 LWG Motion 13
P0325R4 to_array from LFTS with updates Fixes #3017.
2 parents 27cad22 + ad7d09c commit e645604

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

source/containers.tex

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3148,7 +3148,13 @@
31483148
template<class T, size_t N>
31493149
constexpr void swap(array<T, N>& x, array<T, N>& y) noexcept(noexcept(x.swap(y)));
31503150

3151-
// \ref{array.tuple}, tuple interface to class template \tcode{array}
3151+
// \ref{array.creation}, array creation functions
3152+
template<class T, size_t N>
3153+
constexpr array<remove_cv_t<T>, N> to_array(T (&a)[N]);
3154+
template<class T, size_t N>
3155+
constexpr array<remove_cv_t<T>, N> to_array(T (&&a)[N]);
3156+
3157+
// \ref{array.tuple}, tuple interface
31523158
template<class T> struct tuple_size;
31533159
template<size_t I, class T> struct tuple_element;
31543160
template<class T, size_t N>
@@ -3520,6 +3526,49 @@
35203526
Member function \tcode{swap()} shall have a
35213527
non-throwing exception specification.
35223528

3529+
\rSec3[array.creation]{Array creation functions}
3530+
\indextext{\idxcode{array}!creation}%
3531+
3532+
\indexlibrary{\idxcode{to_array}}%
3533+
\begin{itemdecl}
3534+
template<class T, size_t N>
3535+
constexpr array<remove_cv_t<T>, N> to_array(T (&a)[N]);
3536+
\end{itemdecl}
3537+
3538+
\begin{itemdescr}
3539+
\pnum
3540+
\mandates
3541+
\tcode{is_array_v<T>} is \tcode{false} and
3542+
\tcode{is_constructible_v<T, T\&>} is \tcode{true}.
3543+
3544+
\pnum
3545+
\expects
3546+
\tcode{T} meets the \oldconcept{CopyConstructible} requirements.
3547+
3548+
\pnum
3549+
\returns \tcode{\{\{ a[0], $\dotsc$, a[N - 1] \}\}}.
3550+
\end{itemdescr}
3551+
3552+
\indexlibrary{\idxcode{to_array}}%
3553+
\begin{itemdecl}
3554+
template<class T, size_t N>
3555+
constexpr array<remove_cv_t<T>, N> to_array(T (&&a)[N]);
3556+
\end{itemdecl}
3557+
3558+
\begin{itemdescr}
3559+
\pnum
3560+
\mandates
3561+
\tcode{is_array_v<T>} is \tcode{false} and
3562+
\tcode{is_move_constructible_v<T>} is \tcode{true}.
3563+
3564+
\pnum
3565+
\expects
3566+
\tcode{T} meets the \oldconcept{MoveConstructible} requirements.
3567+
3568+
\pnum
3569+
\returns \tcode{\{\{ std::move(a[0]), $\dotsc$, std::move(a[N - 1]) \}\}}.
3570+
\end{itemdescr}
3571+
35233572
\rSec3[array.tuple]{Tuple interface}
35243573
\indexlibrary{\idxcode{array}}%
35253574
\indexlibrary{\idxcode{tuple}}%

source/support.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,8 @@
708708
\tcode{<string>} \tcode{<string_view>} \\ \rowsep
709709
\defnlibxname{cpp_lib_three_way_comparison} & \tcode{201711L} &
710710
\tcode{<compare>} \\ \rowsep
711+
\defnlibxname{cpp_lib_to_array} & \tcode{201907L} &
712+
\tcode{<array>} \\ \rowsep
711713
\defnlibxname{cpp_lib_to_chars} & \tcode{201611L} &
712714
\tcode{<charconv>} \\ \rowsep
713715
\defnlibxname{cpp_lib_transformation_trait_aliases} & \tcode{201304L} &

0 commit comments

Comments
 (0)