diff options
author | Edward Smith-Rowland <3dw4rd@verizon.net> | 2019-11-15 00:09:49 +0000 |
---|---|---|
committer | Edward Smith-Rowland <emsr@gcc.gnu.org> | 2019-11-15 00:09:49 +0000 |
commit | 1c09b66494991a4ac63aaf34c0ca1081b887284c (patch) | |
tree | 29c046c238cc5f8827966dfc9c32bb8e4dd12c1a /libstdc++-v3/include/std/array | |
parent | 2cc94aa8d817bab3af6ff5b41135ad30ee50f09b (diff) | |
download | gcc-1c09b66494991a4ac63aaf34c0ca1081b887284c.zip gcc-1c09b66494991a4ac63aaf34c0ca1081b887284c.tar.gz gcc-1c09b66494991a4ac63aaf34c0ca1081b887284c.tar.bz2 |
Implement the <array> part of C++20 p1032 Misc constexpr bits.
2019-11-14 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement the <array> part of C++20 p1032 Misc constexpr bits.
* include/std/array (fill, swap): Make constexpr.
* testsuite/23_containers/array/requirements/constexpr_fill.cc: New.
* testsuite/23_containers/array/requirements/constexpr_swap.cc: New.
From-SVN: r278269
Diffstat (limited to 'libstdc++-v3/include/std/array')
-rw-r--r-- | libstdc++-v3/include/std/array | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index b1dc888..9ad1e65 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -112,11 +112,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // No explicit construct/copy/destroy for aggregate type. // DR 776. - void + _GLIBCXX20_CONSTEXPR void fill(const value_type& __u) { std::fill_n(begin(), size(), __u); } - void + _GLIBCXX20_CONSTEXPR void swap(array& __other) noexcept(_AT_Type::_Is_nothrow_swappable::value) { std::swap_ranges(begin(), end(), __other.begin()); } @@ -288,6 +288,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // Specialized algorithms. template<typename _Tp, std::size_t _Nm> + _GLIBCXX20_CONSTEXPR inline #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 // Constrained free swap overload, see p0185r1 @@ -295,7 +296,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value >::type #else - _GLIBCXX20_CONSTEXPR void #endif swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) |