summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include/tuple
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libc++/include/tuple')
-rw-r--r--contrib/libc++/include/tuple94
1 files changed, 66 insertions, 28 deletions
diff --git a/contrib/libc++/include/tuple b/contrib/libc++/include/tuple
index 683c9dd..65af3eb 100644
--- a/contrib/libc++/include/tuple
+++ b/contrib/libc++/include/tuple
@@ -130,7 +130,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_VISIBLE allocator_arg_t { };
+#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
extern const allocator_arg_t allocator_arg;
+#else
+constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+#endif
// uses_allocator
@@ -227,7 +231,8 @@ class __tuple_leaf
__tuple_leaf& operator=(const __tuple_leaf&);
public:
- _LIBCPP_INLINE_VISIBILITY __tuple_leaf() : value()
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
+ _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value()
{static_assert(!is_reference<_Hp>::value,
"Attempted to default construct a reference element in a tuple");}
@@ -255,7 +260,7 @@ public:
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
- explicit __tuple_leaf(_Tp&& __t)
+ explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
: value(_VSTD::forward<_Tp>(__t))
{static_assert(!is_reference<_Hp>::value ||
(is_lvalue_reference<_Hp>::value &&
@@ -311,19 +316,20 @@ public:
>::value)),
"Attempted to construct a reference element in a tuple with an rvalue");}
- __tuple_leaf(const __tuple_leaf& __t)
+ __tuple_leaf(const __tuple_leaf& __t) _NOEXCEPT_(is_nothrow_copy_constructible<_Hp>::value)
: value(__t.get())
{static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
+ _NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value))
: value(__t.get()) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
__tuple_leaf&
- operator=(_Tp&& __t)
+ operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
{
value = _VSTD::forward<_Tp>(__t);
return *this;
@@ -336,8 +342,8 @@ public:
return 0;
}
- _LIBCPP_INLINE_VISIBILITY _Hp& get() {return value;}
- _LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return value;}
+ _LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return value;}
+ _LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return value;}
};
template <size_t _Ip, class _Hp>
@@ -347,7 +353,8 @@ class __tuple_leaf<_Ip, _Hp, true>
__tuple_leaf& operator=(const __tuple_leaf&);
public:
- _LIBCPP_INLINE_VISIBILITY __tuple_leaf() {}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
+ _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -366,7 +373,7 @@ public:
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
- explicit __tuple_leaf(_Tp&& __t)
+ explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
: _Hp(_VSTD::forward<_Tp>(__t)) {}
template <class _Tp, class _Alloc>
@@ -387,12 +394,13 @@ public:
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
+ _NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value))
: _Hp(__t.get()) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
__tuple_leaf&
- operator=(_Tp&& __t)
+ operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
{
_Hp::operator=(_VSTD::forward<_Tp>(__t));
return *this;
@@ -406,13 +414,13 @@ public:
return 0;
}
- _LIBCPP_INLINE_VISIBILITY _Hp& get() {return static_cast<_Hp&>(*this);}
- _LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return static_cast<const _Hp&>(*this);}
+ _LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);}
+ _LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);}
};
template <class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
-void __swallow(_Tp&&...) {}
+void __swallow(_Tp&&...) _NOEXCEPT {}
template <bool ...> struct __all;
@@ -436,13 +444,19 @@ template<size_t ..._Indx, class ..._Tp>
struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
: public __tuple_leaf<_Indx, _Tp>...
{
+ _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR __tuple_impl()
+ _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+
template <size_t ..._Uf, class ..._Tf,
size_t ..._Ul, class ..._Tl, class ..._Up>
_LIBCPP_INLINE_VISIBILITY
explicit
__tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
- _Up&&... __u) :
+ _Up&&... __u)
+ _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
+ __all<is_nothrow_default_constructible<_Tl>::value...>::value)) :
__tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))...,
__tuple_leaf<_Ul, _Tl>()...
{}
@@ -467,7 +481,8 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
>::type
>
_LIBCPP_INLINE_VISIBILITY
- __tuple_impl(_Tuple&& __t)
+ __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
+ typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
: __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
{}
@@ -493,7 +508,8 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
__tuple_assignable<_Tuple, tuple<_Tp...> >::value,
__tuple_impl&
>::type
- operator=(_Tuple&& __t)
+ operator=(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_assignable<_Tp&, typename tuple_element<_Indx,
+ typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
{
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...);
@@ -502,7 +518,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
_LIBCPP_INLINE_VISIBILITY
__tuple_impl&
- operator=(const __tuple_impl& __t)
+ operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
{
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
return *this;
@@ -532,7 +548,11 @@ class _LIBCPP_VISIBLE tuple
public:
_LIBCPP_INLINE_VISIBILITY
- explicit tuple(const _Tp& ... __t)
+ _LIBCPP_CONSTEXPR tuple()
+ _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+
+ _LIBCPP_INLINE_VISIBILITY
+ explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
@@ -568,6 +588,15 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
tuple(_Up&&... __u)
+ _NOEXCEPT_((
+ is_nothrow_constructible<
+ typename __make_tuple_indices<sizeof...(_Up)>::type,
+ typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
+ typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
+ typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
+ _Up...
+ >::value
+ ))
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
@@ -600,6 +629,15 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(_Up&&... __u)
+ _NOEXCEPT_((
+ is_nothrow_constructible<
+ typename __make_tuple_indices<sizeof...(_Up)>::type,
+ typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
+ typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
+ typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
+ _Up...
+ >::value
+ ))
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
@@ -637,7 +675,7 @@ public:
>::type = false
>
_LIBCPP_INLINE_VISIBILITY
- tuple(_Tuple&& __t)
+ tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
: base_(_VSTD::forward<_Tuple>(__t)) {}
template <class _Tuple,
@@ -650,7 +688,7 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
explicit
- tuple(_Tuple&& __t)
+ tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
: base_(_VSTD::forward<_Tuple>(__t)) {}
template <class _Alloc, class _Tuple,
@@ -671,7 +709,7 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
tuple&
- operator=(_Tuple&& __t)
+ operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<base&, _Tuple>::value))
{
base_.operator=(_VSTD::forward<_Tuple>(__t));
return *this;
@@ -687,19 +725,19 @@ class _LIBCPP_VISIBLE tuple<>
{
public:
_LIBCPP_INLINE_VISIBILITY
- tuple() {}
+ _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- tuple(allocator_arg_t, const _Alloc&) {}
+ tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- tuple(allocator_arg_t, const _Alloc&, const tuple&) {}
+ tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- tuple(array<_Up, 0>) {}
+ tuple(array<_Up, 0>) _NOEXCEPT {}
template <class _Alloc, class _Up>
_LIBCPP_INLINE_VISIBILITY
- tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) {}
+ tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY
void swap(tuple&) _NOEXCEPT {}
};
@@ -750,7 +788,7 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT
template <class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&...>
-tie(_Tp&... __t)
+tie(_Tp&... __t) _NOEXCEPT
{
return tuple<_Tp&...>(__t...);
}
@@ -765,7 +803,7 @@ struct __ignore_t
namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
-template <class _Tp> class reference_wrapper;
+template <class _Tp> class _LIBCPP_VISIBLE reference_wrapper;
template <class _Tp>
struct ___make_tuple_return
@@ -796,7 +834,7 @@ make_tuple(_Tp&&... __t)
template <class... _Tp>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&&...>
-forward_as_tuple(_Tp&&... __t)
+forward_as_tuple(_Tp&&... __t) _NOEXCEPT
{
return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
}
OpenPOWER on IntegriCloud