#ifndef SPROUT_UTILITY_PAIR_PAIR_HPP #define SPROUT_UTILITY_PAIR_PAIR_HPP #include #include #include #include #include #include #include #include #include namespace sprout { // // pair // template template inline SPROUT_CONSTEXPR sprout::pair::pair( sprout::tuples::tuple first_args, sprout::tuples::tuple second_args, sprout::index_tuple, sprout::index_tuple ) : first(sprout::tuples::get(first_args)...) , second(sprout::tuples::get(second_args)...) {} template inline SPROUT_CONSTEXPR sprout::pair::pair(pair const&) = default; template inline SPROUT_CONSTEXPR sprout::pair::pair(pair&&) = default; template inline SPROUT_CONSTEXPR sprout::pair::pair() : first() , second() {} template inline SPROUT_CONSTEXPR sprout::pair::pair(T1 const& x, T2 const& y) : first(x) , second(y) {} template template< typename U, typename V, typename > inline SPROUT_CONSTEXPR sprout::pair::pair(U&& x, V&& y) : first(sprout::forward(x)) , second(sprout::forward(y)) {} template template< typename U, typename V, typename > inline SPROUT_CONSTEXPR sprout::pair::pair(sprout::pair const& other) : first(other.first) , second(other.second) {} template template< typename U, typename V, typename > inline SPROUT_CONSTEXPR sprout::pair::pair(sprout::pair&& other) : first(sprout::forward(other.first)) , second(sprout::forward(other.second)) {} #if SPROUT_USE_DELEGATING_CONSTRUCTORS template template< typename... Args1, typename... Args2, typename > inline SPROUT_CONSTEXPR sprout::pair::pair( std::piecewise_construct_t, sprout::tuples::tuple first_args, sprout::tuples::tuple second_args ) : pair( first_args, second_args, sprout::index_range<0, sizeof...(Args1)>::make(), sprout::index_range<0, sizeof...(Args2)>::make() ) {} #endif // #if SPROUT_USE_DELEGATING_CONSTRUCTORS template template< typename U, typename V, typename > inline SPROUT_CONSTEXPR sprout::pair::pair(sprout::tuples::tuple const& other) : first(sprout::tuples::get<0>(other)) , second(sprout::tuples::get<1>(other)) {} template template< typename U, typename V, typename > inline SPROUT_CONSTEXPR sprout::pair::pair(sprout::tuples::tuple&& other) : first(sprout::forward(sprout::tuples::get<0>(other))) , second(sprout::forward(sprout::tuples::get<1>(other))) {} template inline sprout::pair& sprout::pair::operator=(pair const& rhs) = default; template inline sprout::pair& sprout::pair::operator=(pair&& rhs) SPROUT_NOEXCEPT_EXPR(std::is_nothrow_move_assignable::value && std::is_nothrow_move_assignable::value) { first = sprout::forward(rhs.first); second = sprout::forward(rhs.second); return *this; } template template< typename U, typename V, typename > inline sprout::pair& sprout::pair::operator=(sprout::pair const& rhs) { first = rhs.first; second = rhs.second; return *this; } template template< typename U, typename V, typename > inline sprout::pair& sprout::pair::operator=(sprout::pair&& rhs) { first = sprout::forward(rhs.first); second = sprout::forward(rhs.second); return *this; } template template< typename U, typename V, typename > inline sprout::pair& sprout::pair::operator=(sprout::tuples::tuple const& rhs) { first = sprout::tuples::get<0>(rhs); second = sprout::tuples::get<0>(rhs); return *this; } template template< typename U, typename V, typename > inline sprout::pair& sprout::pair::operator=(sprout::tuples::tuple&& rhs) { first = sprout::forward(sprout::tuples::get<0>(rhs)); second = sprout::forward(sprout::tuples::get<1>(rhs)); return *this; } template inline void sprout::pair::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 inline void swap(sprout::pair& lhs, sprout::pair& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) { lhs.swap(rhs); } } // namespace sprout #endif // #ifndef SPROUT_UTILITY_PAIR_PAIR_HPP