diff --git a/doc/array/changes.adoc b/doc/array/changes.adoc index 8992e33..8f10f4c 100644 --- a/doc/array/changes.adoc +++ b/doc/array/changes.adoc @@ -21,3 +21,4 @@ http://www.boost.org/LICENSE_1_0.txt * Removed local `hash_value` overload; `boost::hash` supports array-like types natively. * `array` can now be initialized with `= {{}}`. * Added `operator\<\=>`. +* Added `to_array`. diff --git a/doc/array/reference.adoc b/doc/array/reference.adoc index 114b27a..2639a8b 100644 --- a/doc/array/reference.adoc +++ b/doc/array/reference.adoc @@ -42,6 +42,13 @@ namespace boost { constexpr T& get(array&) noexcept; template constexpr const T& get(const array&) noexcept; + + template + constexpr array to_array( T const (&)[N] ); + template + constexpr array to_array( T (&&)[N] ); + template + constexpr array to_array( T const (&&)[N] ); } ``` @@ -417,3 +424,29 @@ Mandates: :: `Idx < N`. Returns: :: `arr[Idx]`. --- + + +### Creation + +``` +template + constexpr array to_array( T const (&a)[N] ); +``` +[horizontal] +Returns: :: an `array` `r` such that for each `i` in `[0..N)`, `r[i]` is copied from `a[i]`. + +``` +template + constexpr array to_array( T (&&a)[N] ); +``` +[horizontal] +Returns: :: an `array` `r` such that for each `i` in `[0..N)`, `r[i]` is moved from `std::move(a[i])`. + +``` +template + constexpr array to_array( T const (&&a)[N] ); +``` +[horizontal] +Returns: :: an `array` `r` such that for each `i` in `[0..N)`, `r[i]` is copied from `a[i]`. + +---