1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix for GCC4.8

This commit is contained in:
bolero-MURAKAMI 2013-03-31 18:20:59 +09:00
parent 049d4592c2
commit 44f973cc19
5 changed files with 110 additions and 262 deletions

View file

@ -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

View file

@ -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