diff options
author | Ville Voutilainen <ville.voutilainen@gmail.com> | 2016-12-01 18:23:21 +0200 |
---|---|---|
committer | Ville Voutilainen <ville@gcc.gnu.org> | 2016-12-01 18:23:21 +0200 |
commit | a2863bde755d39626ee25e3b7a8875e0d93d7217 (patch) | |
tree | a2bd7318c8afb8108d1a4d091102ab832cc467bb /libstdc++-v3/include/std/array | |
parent | a9c21e2a4f44175eab8588d794a3ea3ce2fa8d0b (diff) | |
download | gcc-a2863bde755d39626ee25e3b7a8875e0d93d7217.zip gcc-a2863bde755d39626ee25e3b7a8875e0d93d7217.tar.gz gcc-a2863bde755d39626ee25e3b7a8875e0d93d7217.tar.bz2 |
Implement LWG 2766,
Swapping non-swappable types and LWG 2749,
swappable traits for variants.
* include/bits/move.h (swap(_Tp&, _Tp&)): Constrain
with __is_tuple_like.
* include/bits/stl_pair.h (swap(pair<_T1, _T2>&, pair<_T1, _T2>&)):
Add a deleted overload.
* include/bits/unique_ptr.h
(swap(unique_ptr<_Tp, _Dp>&, unique_ptr<_Tp, _Dp>&)): Likewise.
* include/std/array
(swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&)): Likewise.
* include/std/optional
(swap(optional<_Tp>&, optional<_Tp>&)): Likewise.
* include/std/tuple (__is_tuple_like_impl, __is_tuple_like):
Move to type_traits.
(swap(tuple<_Elements...>&, tuple<_Elements...>&)): Add a deleted
overload.
* include/std/type_traits (__is_tuple_like_impl, __is_tuple_like):
New.
(swap(_Tp&, _Tp&)): Constrain with __is_tuple_like.
* include/std/utility (__is_tuple_like_impl): Move to type_traits.
* include/std/variant
(swap(variant<_Types...>&, variant<_Types...>&)):
Add a deleted overload.
* testsuite/20_util/optional/swap/2.cc: Add tests for disabled
swaps.
* testsuite/20_util/pair/swap_cxx17.cc: New.
* testsuite/20_util/tuple/swap_cxx17.cc: Likewise.
* testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc:
Likewise.
* testsuite/20_util/variant/compile.cc: Add tests for disabled
swaps.
* testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc:
New.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Likewise.
From-SVN: r243120
Diffstat (limited to 'libstdc++-v3/include/std/array')
-rw-r--r-- | libstdc++-v3/include/std/array | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 3ab0355..fa7bac6 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -288,6 +288,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER noexcept(noexcept(__one.swap(__two))) { __one.swap(__two); } +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + template<typename _Tp, std::size_t _Nm> + inline + typename enable_if< + !_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value>::type + swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete; +#endif + template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr _Tp& get(array<_Tp, _Nm>& __arr) noexcept |