summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/std/tuple
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-19 17:20:22 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-19 17:20:22 +0000
commit687570387ecc520d9381b85f24a0ddffd581b207 (patch)
treec54b3620070b6805a4331466f54424e6a1550eee /libstdc++-v3/include/std/tuple
parentbcbb3950721ebd3a78a429fe6109065297fb48d4 (diff)
downloadppe42-gcc-687570387ecc520d9381b85f24a0ddffd581b207.tar.gz
ppe42-gcc-687570387ecc520d9381b85f24a0ddffd581b207.zip
2011-05-19 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/tuple (tuple<>::operator=(tuple&&)): Specify as noexcept. (__get_helper): Likewise. (_Head_base<>::_M_head, _Tuple_impl<>::_M_head, _M_tail): Likewise. * include/bits/move.h (swap): Likewise. * include/bits/algorithmfwd.h (swap): Adjust. * include/bits/stl_pair.h (pair<>::operator=(pair&&)): Spec noexcept. * testsuite/util/testsuite_allocator.h (uneq_allocator): In C++0x mode, prefer delete to access control to make the type not copy assignable. * testsuite/util/testsuite_tr1.h: Add test classes. * testsuite/20_util/tuple/noexcept_swap.cc: New. * testsuite/20_util/tuple/noexcept_move_assign.cc: Likewise. * testsuite/25_algorithms/reverse/moveable.cc: Likewise, prefer delete to access control. * testsuite/25_algorithms/swap_ranges/moveable.cc: Likewise. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-warning line numbers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173917 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/tuple')
-rw-r--r--libstdc++-v3/include/std/tuple28
1 files changed, 16 insertions, 12 deletions
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 066b3d0855c..682e3c92a47 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -85,8 +85,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Head_base(_UHead&& __h)
: _Head(std::forward<_UHead>(__h)) { }
- _Head& _M_head() { return *this; }
- const _Head& _M_head() const { return *this; }
+ _Head& _M_head() noexcept { return *this; }
+ const _Head& _M_head() const noexcept { return *this; }
};
template<std::size_t _Idx, typename _Head>
@@ -102,8 +102,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Head_base(_UHead&& __h)
: _M_head_impl(std::forward<_UHead>(__h)) { }
- _Head& _M_head() { return _M_head_impl; }
- const _Head& _M_head() const { return _M_head_impl; }
+ _Head& _M_head() noexcept { return _M_head_impl; }
+ const _Head& _M_head() const noexcept { return _M_head_impl; }
_Head _M_head_impl;
};
@@ -147,11 +147,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
typedef _Head_base<_Idx, _Head, std::is_empty<_Head>::value> _Base;
- _Head& _M_head() { return _Base::_M_head(); }
- const _Head& _M_head() const { return _Base::_M_head(); }
+ _Head& _M_head() noexcept { return _Base::_M_head(); }
+ const _Head& _M_head() const noexcept { return _Base::_M_head(); }
- _Inherited& _M_tail() { return *this; }
- const _Inherited& _M_tail() const { return *this; }
+ _Inherited& _M_tail() noexcept { return *this; }
+ const _Inherited& _M_tail() const noexcept { return *this; }
constexpr _Tuple_impl()
: _Inherited(), _Base() { }
@@ -191,6 +191,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Tuple_impl&
operator=(_Tuple_impl&& __in)
+ noexcept(is_nothrow_move_assignable<_Head>::value
+ && is_nothrow_move_assignable<_Inherited>::value)
{
_M_head() = std::forward<_Head>(__in._M_head());
_M_tail() = std::move(__in._M_tail());
@@ -276,6 +278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple&
operator=(tuple&& __in)
+ noexcept(is_nothrow_move_assignable<_Inherited>::value)
{
static_cast<_Inherited&>(*this) = std::move(__in);
return *this;
@@ -364,7 +367,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple&
operator=(tuple&& __in)
- // noexcept has to wait is_nothrow_move_assignable
+ noexcept(is_nothrow_move_assignable<_Inherited>::value)
{
static_cast<_Inherited&>(*this) = std::move(__in);
return *this;
@@ -397,7 +400,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _U1, typename _U2>
tuple&
- operator=(pair<_U1, _U2>&& __in) noexcept
+ operator=(pair<_U1, _U2>&& __in)
{
this->_M_head() = std::forward<_U1>(__in.first);
this->_M_tail()._M_head() = std::forward<_U2>(__in.second);
@@ -452,6 +455,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple&
operator=(tuple&& __in)
+ noexcept(is_nothrow_move_assignable<_Inherited>::value)
{
static_cast<_Inherited&>(*this) = std::move(__in);
return *this;
@@ -517,12 +521,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<std::size_t __i, typename _Head, typename... _Tail>
inline typename __add_ref<_Head>::type
- __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t)
+ __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
{ return __t._M_head(); }
template<std::size_t __i, typename _Head, typename... _Tail>
inline typename __add_c_ref<_Head>::type
- __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t)
+ __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
{ return __t._M_head(); }
// Return a reference (const reference, rvalue reference) to the ith element
OpenPOWER on IntegriCloud