aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/array
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/std/array')
-rw-r--r--libstdc++-v3/include/std/array16
1 files changed, 14 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index ee46f68..73d2669 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -48,6 +48,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
struct __array_traits
{
typedef _Tp _Type[_Nm];
+ typedef __is_swappable<_Tp> _Is_swappable;
+ typedef __is_nothrow_swappable<_Tp> _Is_nothrow_swappable;
static constexpr _Tp&
_S_ref(const _Type& __t, std::size_t __n) noexcept
@@ -62,6 +64,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
struct __array_traits<_Tp, 0>
{
struct _Type { };
+ typedef true_type _Is_swappable;
+ typedef true_type _Is_nothrow_swappable;
static constexpr _Tp&
_S_ref(const _Type&, std::size_t) noexcept
@@ -114,7 +118,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
void
swap(array& __other)
- noexcept(__is_nothrow_swappable<_Tp>::value)
+ noexcept(_AT_Type::_Is_nothrow_swappable::value)
{ std::swap_ranges(begin(), end(), __other.begin()); }
// Iterators.
@@ -271,7 +275,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Specialized algorithms.
template<typename _Tp, std::size_t _Nm>
- inline void
+ inline
+#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
+ // Constrained free swap overload, see p0185r1
+ typename enable_if<
+ _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value
+ >::type
+#else
+ void
+#endif
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
noexcept(noexcept(__one.swap(__two)))
{ __one.swap(__two); }