_Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
: _Head(std::forward<_UHead>(__uhead), *__a._M_a) { }
- _Head&
- _M_head() noexcept { return *this; }
+ static constexpr _Head&
+ _M_head(_Head_base& __b) noexcept { return __b; }
- constexpr const _Head&
- _M_head() const noexcept { return *this; }
+ static constexpr const _Head&
+ _M_head(const _Head_base& __b) noexcept { return __b; }
};
template<std::size_t _Idx, typename _Head>
_Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
: _M_head_impl(std::forward<_UHead>(__uhead), *__a._M_a) { }
- _Head&
- _M_head() noexcept { return _M_head_impl; }
+ static constexpr _Head&
+ _M_head(_Head_base& __b) noexcept { return __b._M_head_impl; }
- constexpr const _Head&
- _M_head() const noexcept { return _M_head_impl; }
+ static constexpr const _Head&
+ _M_head(const _Head_base& __b) noexcept { return __b._M_head_impl; }
- _Head _M_head_impl;
+ _Head _M_head_impl;
};
/**
typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
typedef _Head_base<_Idx, _Head, std::is_empty<_Head>::value> _Base;
- _Head&
- _M_head() noexcept { return _Base::_M_head(); }
+ static constexpr _Head&
+ _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
- constexpr const _Head&
- _M_head() const noexcept { return _Base::_M_head(); }
+ static constexpr const _Head&
+ _M_head(const _Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
- _Inherited&
- _M_tail() noexcept { return *this; }
+ static constexpr _Inherited&
+ _M_tail(_Tuple_impl& __t) noexcept { return __t; }
- constexpr const _Inherited&
- _M_tail() const noexcept { return *this; }
+ static constexpr const _Inherited&
+ _M_tail(const _Tuple_impl& __t) noexcept { return __t; }
constexpr _Tuple_impl()
: _Inherited(), _Base() { }
_Tuple_impl(_Tuple_impl&& __in)
noexcept(__and_<is_nothrow_move_constructible<_Head>,
is_nothrow_move_constructible<_Inherited>>::value)
- : _Inherited(std::move(__in._M_tail())),
- _Base(std::forward<_Head>(__in._M_head())) { }
+ : _Inherited(std::move(_M_tail(__in))),
+ _Base(std::forward<_Head>(_M_head(__in))) { }
template<typename... _UElements>
constexpr _Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in)
- : _Inherited(__in._M_tail()), _Base(__in._M_head()) { }
+ : _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)),
+ _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { }
template<typename _UHead, typename... _UTails>
_Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
- : _Inherited(std::move(__in._M_tail())),
- _Base(std::forward<_UHead>(__in._M_head())) { }
+ : _Inherited(std::move
+ (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
+ _Base(std::forward<_UHead>
+ (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a)
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
const _Tuple_impl& __in)
- : _Inherited(__tag, __a, __in._M_tail()),
- _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __in._M_head()) { }
+ : _Inherited(__tag, __a, _M_tail(__in)),
+ _Base(__use_alloc<_Head, _Alloc, _Head>(__a), _M_head(__in)) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
_Tuple_impl&& __in)
- : _Inherited(__tag, __a, std::move(__in._M_tail())),
+ : _Inherited(__tag, __a, std::move(_M_tail(__in))),
_Base(__use_alloc<_Head, _Alloc, _Head>(__a),
- std::forward<_Head>(__in._M_head())) { }
+ std::forward<_Head>(_M_head(__in))) { }
template<typename _Alloc, typename... _UElements>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
const _Tuple_impl<_Idx, _UElements...>& __in)
- : _Inherited(__tag, __a, __in._M_tail()),
- _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __in._M_head()) { }
+ : _Inherited(__tag, __a,
+ _Tuple_impl<_Idx, _UElements...>::_M_tail(__in)),
+ _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
+ _Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { }
template<typename _Alloc, typename _UHead, typename... _UTails>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
- : _Inherited(__tag, __a, std::move(__in._M_tail())),
+ : _Inherited(__tag, __a, std::move
+ (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
_Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
- std::forward<_UHead>(__in._M_head())) { }
+ std::forward<_UHead>
+ (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) { }
_Tuple_impl&
operator=(const _Tuple_impl& __in)
{
- _M_head() = __in._M_head();
- _M_tail() = __in._M_tail();
+ _M_head(*this) = _M_head(__in);
+ _M_tail(*this) = _M_tail(__in);
return *this;
}
noexcept(__and_<is_nothrow_move_assignable<_Head>,
is_nothrow_move_assignable<_Inherited>>::value)
{
- _M_head() = std::forward<_Head>(__in._M_head());
- _M_tail() = std::move(__in._M_tail());
+ _M_head(*this) = std::forward<_Head>(_M_head(__in));
+ _M_tail(*this) = std::move(_M_tail(__in));
return *this;
}
_Tuple_impl&
operator=(const _Tuple_impl<_Idx, _UElements...>& __in)
{
- _M_head() = __in._M_head();
- _M_tail() = __in._M_tail();
+ _M_head(*this) = _Tuple_impl<_Idx, _UElements...>::_M_head(__in);
+ _M_tail(*this) = _Tuple_impl<_Idx, _UElements...>::_M_tail(__in);
return *this;
}
_Tuple_impl&
operator=(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
{
- _M_head() = std::forward<_UHead>(__in._M_head());
- _M_tail() = std::move(__in._M_tail());
+ _M_head(*this) = std::forward<_UHead>
+ (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in));
+ _M_tail(*this) = std::move
+ (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in));
return *this;
}
_M_swap(_Tuple_impl& __in)
noexcept(noexcept(swap(std::declval<_Head&>(),
std::declval<_Head&>()))
- && noexcept(__in._M_tail()._M_swap(__in._M_tail())))
+ && noexcept(_M_tail(__in)._M_swap(_M_tail(__in))))
{
using std::swap;
- swap(this->_M_head(), __in._M_head());
- _Inherited::_M_swap(__in._M_tail());
+ swap(_M_head(*this), _M_head(__in));
+ _Inherited::_M_swap(_M_tail(__in));
}
};
tuple&
operator=(const pair<_U1, _U2>& __in)
{
- this->_M_head() = __in.first;
- this->_M_tail()._M_head() = __in.second;
+ this->_M_head(*this) = __in.first;
+ this->_M_tail(*this)._M_head(*this) = __in.second;
return *this;
}
tuple&
operator=(pair<_U1, _U2>&& __in)
{
- this->_M_head() = std::forward<_U1>(__in.first);
- this->_M_tail()._M_head() = std::forward<_U2>(__in.second);
+ this->_M_head(*this) = std::forward<_U1>(__in.first);
+ this->_M_tail(*this)._M_head(*this) = std::forward<_U2>(__in.second);
return *this;
}
: public integral_constant<std::size_t, sizeof...(_Elements)> { };
template<std::size_t __i, typename _Head, typename... _Tail>
- inline typename __add_ref<_Head>::type
+ constexpr typename __add_ref<_Head>::type
__get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
- { return __t._M_head(); }
+ { return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
template<std::size_t __i, typename _Head, typename... _Tail>
- inline constexpr typename __add_c_ref<_Head>::type
+ constexpr typename __add_c_ref<_Head>::type
__get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
- { return __t._M_head(); }
+ { return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
// Return a reference (const reference, rvalue reference) to the ith element
// of a tuple. Any const or non-const ref elements are returned with their
// original type.
template<std::size_t __i, typename... _Elements>
- inline typename __add_ref<
+ constexpr typename __add_ref<
typename tuple_element<__i, tuple<_Elements...>>::type
>::type
get(tuple<_Elements...>& __t) noexcept
{ return __get_helper<__i>(__t); }
template<std::size_t __i, typename... _Elements>
- inline constexpr typename __add_c_ref<
+ constexpr typename __add_c_ref<
typename tuple_element<__i, tuple<_Elements...>>::type
>::type
get(const tuple<_Elements...>& __t) noexcept
{ return __get_helper<__i>(__t); }
template<std::size_t __i, typename... _Elements>
- inline typename __add_r_ref<
+ constexpr typename __add_r_ref<
typename tuple_element<__i, tuple<_Elements...>>::type
>::type
get(tuple<_Elements...>&& __t) noexcept
template<typename, std::size_t> struct array;
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
- _Tp& get(array<_Tp, _Nm>&) noexcept;
+ constexpr _Tp& get(array<_Tp, _Nm>&) noexcept;
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
- _Tp&& get(array<_Tp, _Nm>&&) noexcept;
+ constexpr _Tp&& get(array<_Tp, _Nm>&&) noexcept;
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
- const _Tp& get(const array<_Tp, _Nm>&) noexcept;
+ constexpr const _Tp& get(const array<_Tp, _Nm>&) noexcept;
template<typename>
struct __is_tuple_like_impl : false_type
struct __tuple_concater<_Ret, std::_Index_tuple<_Is...>, _Tp, _Tpls...>
{
template<typename... _Us>
- static _Ret
+ static constexpr _Ret
_S_do(_Tp&& __tp, _Tpls&&... __tps, _Us&&... __us)
{
typedef typename __make_1st_indices<_Tpls...>::__type __idx;
struct __tuple_concater<_Ret, std::_Index_tuple<>>
{
template<typename... _Us>
- static _Ret
+ static constexpr _Ret
_S_do(_Us&&... __us)
{
return _Ret(std::forward<_Us>(__us)...);
}
};
- template<typename... _Tpls>
- inline typename
- std::enable_if<__and_<__is_tuple_like<_Tpls>...>::value,
- typename __tuple_cat_result<_Tpls...>::__type>::type
+ template<typename... _Tpls, typename = typename
+ enable_if<__and_<__is_tuple_like<_Tpls>...>::value>::type>
+ constexpr auto
tuple_cat(_Tpls&&... __tpls)
+ -> typename __tuple_cat_result<_Tpls...>::__type
{
typedef typename __tuple_cat_result<_Tpls...>::__type __ret;
typedef typename __make_1st_indices<_Tpls...>::__type __idx;