mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
fix for GCC4.8
This commit is contained in:
parent
049d4592c2
commit
44f973cc19
5 changed files with 110 additions and 262 deletions
|
@ -1,15 +1,9 @@
|
|||
#ifndef SPROUT_TUPLE_TUPLE_TUPLE_HPP
|
||||
#define SPROUT_TUPLE_TUPLE_TUPLE_HPP
|
||||
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/move.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/utility/pair/pair_decl.hpp>
|
||||
#include <sprout/type_traits/is_convert_constructible.hpp>
|
||||
#include <sprout/tpp/algorithm/all_of.hpp>
|
||||
#include <sprout/tuple/tuple/tuple_decl.hpp>
|
||||
#include <sprout/tuple/flexibly_construct.hpp>
|
||||
|
||||
|
@ -20,42 +14,6 @@ namespace sprout {
|
|||
//
|
||||
// tuple construction
|
||||
template<typename... Types>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple()
|
||||
: impl_type()
|
||||
{}
|
||||
template<typename... Types>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(Types const&... elements)
|
||||
: impl_type(elements...)
|
||||
{}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(UTypes&&... elements)
|
||||
: impl_type(sprout::forward<UTypes>(elements)...)
|
||||
{}
|
||||
template<typename... Types>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(tuple const&) = default;
|
||||
template<typename... Types>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(tuple&&) = default;
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::tuple<UTypes...> const& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...> const&>(t))
|
||||
{}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::tuple<UTypes...>&& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...>&&>(t))
|
||||
{}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename
|
||||
|
@ -72,30 +30,6 @@ namespace sprout {
|
|||
: impl_type(sprout::forward<typename sprout::pair<UTypes...>::first_type>(t.first), sprout::forward<typename sprout::pair<UTypes...>::second_type>(t.second))
|
||||
{}
|
||||
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, UTypes&&... elements)
|
||||
: impl_type(sprout::forward<UTypes>(elements)...)
|
||||
{}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...> const& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...> const&>(t))
|
||||
{}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...>&& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...>&&>(t))
|
||||
{}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
|
@ -112,71 +46,6 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...>&& t)
|
||||
: impl_type(sprout::forward<typename sprout::pair<UTypes...>::first_type>(t.first), sprout::forward<typename sprout::pair<UTypes...>::second_type>(t.second))
|
||||
{}
|
||||
// tuple assignment
|
||||
template<typename... Types>
|
||||
sprout::tuples::tuple<Types...>& sprout::tuples::tuple<Types...>::operator=(tuple const& rhs) {
|
||||
static_cast<impl_type&>(*this) = rhs;
|
||||
return *this;
|
||||
}
|
||||
template<typename... Types>
|
||||
sprout::tuples::tuple<Types...>& sprout::tuples::tuple<Types...>::operator=(tuple&& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::tpp::all_of<std::is_nothrow_move_assignable<Types>...>::value)
|
||||
{
|
||||
static_cast<impl_type&>(*this) = sprout::move(rhs);
|
||||
return *this;
|
||||
}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename
|
||||
>
|
||||
sprout::tuples::tuple<Types...>& sprout::tuples::tuple<Types...>::operator=(sprout::tuples::tuple<UTypes...> const& rhs) {
|
||||
static_cast<impl_type&>(*this) = rhs;
|
||||
return *this;
|
||||
}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename
|
||||
>
|
||||
sprout::tuples::tuple<Types...>& sprout::tuples::tuple<Types...>::operator=(sprout::tuples::tuple<UTypes...>&& rhs) {
|
||||
static_cast<impl_type&>(*this) = sprout::move(rhs);
|
||||
return *this;
|
||||
}
|
||||
// tuple swap
|
||||
template<typename... Types>
|
||||
inline void sprout::tuples::tuple<Types...>::swap(tuple& other)
|
||||
SPROUT_NOEXCEPT_EXPR(has_nothrow_swap::value)
|
||||
{
|
||||
impl_type::swap(other);
|
||||
}
|
||||
|
||||
//
|
||||
// tuple
|
||||
//
|
||||
// tuple construction
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<>::tuple() = default;
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<>::tuple(tuple const&) = default;
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<>::tuple(tuple&&) = default;
|
||||
template<typename... UTypes>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<>::tuple(sprout::tuples::flexibly_construct_t, UTypes&&... elements) {}
|
||||
template<typename... UTypes>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<>::tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...> const& t) {}
|
||||
template<typename... UTypes>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<>::tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...>&& t) {}
|
||||
// tuple swap
|
||||
inline void sprout::tuples::tuple<>::swap(tuple&) SPROUT_NOEXCEPT {}
|
||||
|
||||
//
|
||||
// swap
|
||||
//
|
||||
template<typename... Types>
|
||||
inline void
|
||||
swap(sprout::tuples::tuple<Types...>& lhs, sprout::tuples::tuple<Types...>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
} // namespace tuples
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -256,11 +256,6 @@ namespace sprout {
|
|||
>
|
||||
{};
|
||||
public:
|
||||
struct has_nothrow_swap
|
||||
: public sprout::tpp::all_of_c<
|
||||
SPROUT_NOEXCEPT_EXPR_OR_DEFAULT(sprout::swap(std::declval<Types&>(), std::declval<Types&>()), false)...
|
||||
>
|
||||
{};
|
||||
template<typename... UTypes>
|
||||
struct is_flexibly_convert_constructible
|
||||
: public is_flexibly_convert_constructible_impl<
|
||||
|
@ -278,31 +273,41 @@ namespace sprout {
|
|||
{};
|
||||
public:
|
||||
// tuple construction
|
||||
SPROUT_CONSTEXPR tuple();
|
||||
explicit SPROUT_CONSTEXPR tuple(Types const&... elements);
|
||||
SPROUT_CONSTEXPR tuple()
|
||||
: impl_type()
|
||||
{}
|
||||
explicit SPROUT_CONSTEXPR tuple(Types const&... elements)
|
||||
: impl_type(elements...)
|
||||
{}
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename = typename std::enable_if<
|
||||
sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes&&>...>::value
|
||||
>::type
|
||||
>
|
||||
explicit SPROUT_CONSTEXPR tuple(UTypes&&... elements);
|
||||
SPROUT_CONSTEXPR tuple(tuple const&);
|
||||
SPROUT_CONSTEXPR tuple(tuple&&);
|
||||
explicit SPROUT_CONSTEXPR tuple(UTypes&&... elements)
|
||||
: impl_type(sprout::forward<UTypes>(elements)...)
|
||||
{}
|
||||
SPROUT_CONSTEXPR tuple(tuple const&) = default;
|
||||
SPROUT_CONSTEXPR tuple(tuple&&) = default;
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename = typename std::enable_if<
|
||||
sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes const&>...>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::tuple<UTypes...> const& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::tuple<UTypes...> const& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...> const&>(t))
|
||||
{}
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename = typename std::enable_if<
|
||||
sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes&&>...>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::tuple<UTypes...>&& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::tuple<UTypes...>&& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...>&&>(t))
|
||||
{}
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename = typename std::enable_if<
|
||||
|
@ -324,21 +329,27 @@ namespace sprout {
|
|||
is_rvref_flexibly_convert_constructible<UTypes...>::value
|
||||
>::type
|
||||
>
|
||||
explicit SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, UTypes&&... elements);
|
||||
explicit SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, UTypes&&... elements)
|
||||
: impl_type(sprout::forward<UTypes>(elements)...)
|
||||
{}
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename = typename std::enable_if<
|
||||
is_clvref_flexibly_convert_constructible<UTypes...>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...> const& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...> const& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...> const&>(t))
|
||||
{}
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename = typename std::enable_if<
|
||||
is_rvref_flexibly_convert_constructible<UTypes...>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...>&& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...>&& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...>&&>(t))
|
||||
{}
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename = typename std::enable_if<
|
||||
|
@ -354,42 +365,62 @@ namespace sprout {
|
|||
>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...>&& t);
|
||||
// tuple assignment
|
||||
tuple& operator=(tuple const& rhs);
|
||||
tuple& operator=(tuple const& rhs) {
|
||||
static_cast<impl_type&>(*this) = rhs;
|
||||
return *this;
|
||||
}
|
||||
tuple& operator=(tuple&& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::tpp::all_of<std::is_nothrow_move_assignable<Types>...>::value);
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::tpp::all_of<std::is_nothrow_move_assignable<Types>...>::value)
|
||||
{
|
||||
static_cast<impl_type&>(*this) = sprout::move(rhs);
|
||||
return *this;
|
||||
}
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename = typename std::enable_if<
|
||||
sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of<std::is_assignable<Types&, UTypes const&>...>::value
|
||||
>::type
|
||||
>
|
||||
tuple& operator=(sprout::tuples::tuple<UTypes...> const& rhs);
|
||||
tuple& operator=(sprout::tuples::tuple<UTypes...> const& rhs) {
|
||||
static_cast<impl_type&>(*this) = rhs;
|
||||
return *this;
|
||||
}
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename = typename std::enable_if<
|
||||
sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of<std::is_assignable<Types&, UTypes&&>...>::value
|
||||
>::type
|
||||
>
|
||||
tuple& operator=(sprout::tuples::tuple<UTypes...>&& rhs);
|
||||
tuple& operator=(sprout::tuples::tuple<UTypes...>&& rhs) {
|
||||
static_cast<impl_type&>(*this) = sprout::move(rhs);
|
||||
return *this;
|
||||
}
|
||||
// tuple swap
|
||||
void swap(tuple& other)
|
||||
SPROUT_NOEXCEPT_EXPR(has_nothrow_swap::value);
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::tpp::all_of_c<SPROUT_NOEXCEPT_EXPR_OR_DEFAULT(sprout::swap(std::declval<Types&>(), std::declval<Types&>()), false)...>::value)
|
||||
{
|
||||
impl_type::swap(other);
|
||||
}
|
||||
};
|
||||
template<>
|
||||
class tuple<> {
|
||||
public:
|
||||
// tuple construction
|
||||
SPROUT_CONSTEXPR tuple();
|
||||
SPROUT_CONSTEXPR tuple(tuple const&);
|
||||
SPROUT_CONSTEXPR tuple(tuple&&);
|
||||
SPROUT_CONSTEXPR tuple() = default;
|
||||
SPROUT_CONSTEXPR tuple(tuple const&) = default;
|
||||
SPROUT_CONSTEXPR tuple(tuple&&) = default;
|
||||
template<typename... UTypes>
|
||||
explicit SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, UTypes&&... elements);
|
||||
explicit SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, UTypes&&... elements) {}
|
||||
template<typename... UTypes>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...> const& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...> const& t) {}
|
||||
template<typename... UTypes>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...>&& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...>&& t) {}
|
||||
template<typename... UTypes>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...> const& t) {}
|
||||
template<typename... UTypes>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...>&& t) {}
|
||||
// tuple swap
|
||||
void swap(tuple&) SPROUT_NOEXCEPT;
|
||||
void swap(tuple&) SPROUT_NOEXCEPT {}
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -398,7 +429,10 @@ namespace sprout {
|
|||
template<typename... Types>
|
||||
inline void
|
||||
swap(sprout::tuples::tuple<Types...>& lhs, sprout::tuples::tuple<Types...>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)));
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<std::size_t I, typename T>
|
||||
|
|
|
@ -26,47 +26,6 @@ namespace sprout {
|
|||
: first(sprout::tuples::get<Indexes1>(first_args)...)
|
||||
, second(sprout::tuples::get<Indexes2>(second_args)...)
|
||||
{}
|
||||
template <typename T1, typename T2>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<T1, T2>::pair(pair const&) = default;
|
||||
template <typename T1, typename T2>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<T1, T2>::pair(pair&&) = default;
|
||||
template <typename T1, typename T2>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<T1, T2>::pair()
|
||||
: first()
|
||||
, second()
|
||||
{}
|
||||
template <typename T1, typename T2>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<T1, T2>::pair(T1 const& x, T2 const& y)
|
||||
: first(x)
|
||||
, second(y)
|
||||
{}
|
||||
template <typename T1, typename T2>
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<T1, T2>::pair(U&& x, V&& y)
|
||||
: first(sprout::forward<U>(x))
|
||||
, second(sprout::forward<V>(y))
|
||||
{}
|
||||
template <typename T1, typename T2>
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<T1, T2>::pair(sprout::pair<U, V> const& other)
|
||||
: first(other.first)
|
||||
, second(other.second)
|
||||
{}
|
||||
template <typename T1, typename T2>
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<T1, T2>::pair(sprout::pair<U, V>&& other)
|
||||
: first(sprout::forward<U>(other.first))
|
||||
, second(sprout::forward<V>(other.second))
|
||||
{}
|
||||
#if SPROUT_USE_DELEGATING_CONSTRUCTORS
|
||||
template <typename T1, typename T2>
|
||||
template<
|
||||
|
@ -104,36 +63,6 @@ namespace sprout {
|
|||
, second(sprout::forward<V>(sprout::tuples::get<1>(other)))
|
||||
{}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
inline sprout::pair<T1, T2>& sprout::pair<T1, T2>::operator=(pair const& rhs) = default;
|
||||
template <typename T1, typename T2>
|
||||
inline sprout::pair<T1, T2>& sprout::pair<T1, T2>::operator=(pair&& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(std::is_nothrow_move_assignable<T1>::value && std::is_nothrow_move_assignable<T2>::value)
|
||||
{
|
||||
first = sprout::forward<T1>(rhs.first);
|
||||
second = sprout::forward<T2>(rhs.second);
|
||||
return *this;
|
||||
}
|
||||
template <typename T1, typename T2>
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename
|
||||
>
|
||||
inline sprout::pair<T1, T2>& sprout::pair<T1, T2>::operator=(sprout::pair<U, V> const& rhs) {
|
||||
first = rhs.first;
|
||||
second = rhs.second;
|
||||
return *this;
|
||||
}
|
||||
template <typename T1, typename T2>
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename
|
||||
>
|
||||
inline sprout::pair<T1, T2>& sprout::pair<T1, T2>::operator=(sprout::pair<U, V>&& rhs) {
|
||||
first = sprout::forward<U>(rhs.first);
|
||||
second = sprout::forward<V>(rhs.second);
|
||||
return *this;
|
||||
}
|
||||
template <typename T1, typename T2>
|
||||
template<
|
||||
typename U, typename V,
|
||||
|
@ -154,24 +83,6 @@ namespace sprout {
|
|||
second = sprout::forward<V>(sprout::tuples::get<1>(rhs));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
inline void sprout::pair<T1, T2>::swap(pair& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(first, other.first)) && SPROUT_NOEXCEPT_EXPR(sprout::swap(second, other.second))) {
|
||||
sprout::swap(first, other.first);
|
||||
sprout::swap(second, other.second);
|
||||
}
|
||||
|
||||
//
|
||||
// swap
|
||||
//
|
||||
template<typename T1, typename T2>
|
||||
inline void
|
||||
swap(sprout::pair<T1, T2>& lhs, sprout::pair<T1, T2>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_UTILITY_PAIR_PAIR_HPP
|
||||
|
|
|
@ -31,31 +31,46 @@ namespace sprout {
|
|||
sprout::index_tuple<Indexes2...>
|
||||
);
|
||||
public:
|
||||
SPROUT_CONSTEXPR pair(pair const&);
|
||||
SPROUT_CONSTEXPR pair(pair&&);
|
||||
SPROUT_CONSTEXPR pair();
|
||||
SPROUT_CONSTEXPR pair(T1 const& x, T2 const& y);
|
||||
SPROUT_CONSTEXPR pair()
|
||||
: first()
|
||||
, second()
|
||||
{}
|
||||
SPROUT_CONSTEXPR pair(pair const&) = default;
|
||||
SPROUT_CONSTEXPR pair(pair&&) = default;
|
||||
SPROUT_CONSTEXPR pair(T1 const& x, T2 const& y)
|
||||
: first(x)
|
||||
, second(y)
|
||||
{}
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename = typename std::enable_if<
|
||||
std::is_constructible<first_type, U&&>::value && std::is_constructible<second_type, V&&>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR pair(U&& x, V&& y);
|
||||
SPROUT_CONSTEXPR pair(U&& x, V&& y)
|
||||
: first(sprout::forward<U>(x))
|
||||
, second(sprout::forward<V>(y))
|
||||
{}
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename = typename std::enable_if<
|
||||
std::is_constructible<first_type, U const&>::value && std::is_constructible<second_type, V const&>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR pair(sprout::pair<U, V> const& other);
|
||||
SPROUT_CONSTEXPR pair(sprout::pair<U, V> const& other)
|
||||
: first(other.first)
|
||||
, second(other.second)
|
||||
{}
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename = typename std::enable_if<
|
||||
std::is_constructible<first_type, U&&>::value && std::is_constructible<second_type, V&&>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR pair(sprout::pair<U, V>&& other);
|
||||
SPROUT_CONSTEXPR pair(sprout::pair<U, V>&& other)
|
||||
: first(sprout::forward<U>(other.first))
|
||||
, second(sprout::forward<V>(other.second))
|
||||
{}
|
||||
template<
|
||||
typename... Args1, typename... Args2,
|
||||
typename = typename std::enable_if<
|
||||
|
@ -82,23 +97,36 @@ namespace sprout {
|
|||
>
|
||||
SPROUT_CONSTEXPR pair(sprout::tuples::tuple<U, V>&& other);
|
||||
|
||||
pair& operator=(pair const& rhs);
|
||||
pair& operator=(pair const& rhs) = default;
|
||||
pair& operator=(pair&& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(std::is_nothrow_move_assignable<T1>::value && std::is_nothrow_move_assignable<T2>::value);
|
||||
SPROUT_NOEXCEPT_EXPR(std::is_nothrow_move_assignable<T1>::value && std::is_nothrow_move_assignable<T2>::value)
|
||||
{
|
||||
first = sprout::forward<T1>(rhs.first);
|
||||
second = sprout::forward<T2>(rhs.second);
|
||||
return *this;
|
||||
}
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename = typename std::enable_if<
|
||||
std::is_assignable<first_type&, U const&>::value && std::is_assignable<second_type&, V const&>::value
|
||||
>::type
|
||||
>
|
||||
pair& operator=(sprout::pair<U, V> const& rhs);
|
||||
pair& operator=(sprout::pair<U, V> const& rhs) {
|
||||
first = rhs.first;
|
||||
second = rhs.second;
|
||||
return *this;
|
||||
}
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename = typename std::enable_if<
|
||||
std::is_assignable<first_type&, U&&>::value && std::is_assignable<second_type&, V&&>::value
|
||||
>::type
|
||||
>
|
||||
pair& operator=(sprout::pair<U, V>&& rhs);
|
||||
pair& operator=(sprout::pair<U, V>&& rhs) {
|
||||
first = sprout::forward<U>(rhs.first);
|
||||
second = sprout::forward<V>(rhs.second);
|
||||
return *this;
|
||||
}
|
||||
template<
|
||||
typename U, typename V,
|
||||
typename = typename std::enable_if<
|
||||
|
@ -115,7 +143,10 @@ namespace sprout {
|
|||
pair& operator=(sprout::tuples::tuple<U, V>&& rhs);
|
||||
|
||||
void swap(pair& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(first, other.first)) && SPROUT_NOEXCEPT_EXPR(sprout::swap(second, other.second)));
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(first, other.first)) && SPROUT_NOEXCEPT_EXPR(sprout::swap(second, other.second))) {
|
||||
sprout::swap(first, other.first);
|
||||
sprout::swap(second, other.second);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -124,7 +155,10 @@ namespace sprout {
|
|||
template<typename T1, typename T2>
|
||||
inline void
|
||||
swap(sprout::pair<T1, T2>& lhs, sprout::pair<T1, T2>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)));
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_UTILITY_PAIR_PAIR_DECL_HPP
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace testspr {
|
|||
protected:
|
||||
iterator_type current;
|
||||
public:
|
||||
reduct_iterator() = default;
|
||||
SPROUT_CONSTEXPR reduct_iterator() {};
|
||||
SPROUT_CONSTEXPR reduct_iterator(reduct_iterator const& other) = default;
|
||||
explicit SPROUT_CONSTEXPR reduct_iterator(iterator_type it)
|
||||
: current(it)
|
||||
|
|
Loading…
Reference in a new issue