/*============================================================================= Copyright (c) 2011-2013 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_TUPLE_ALGORITHM_COPY_HPP #define SPROUT_TUPLE_ALGORITHM_COPY_HPP #include #include #include #include #include #include namespace sprout { namespace tuples { namespace results { // // copy // template struct copy { public: typedef typename sprout::tuples::tuple_construct_traits::copied_type type; }; } // namespace results namespace detail { template inline SPROUT_CONSTEXPR Result copy_impl( Tuple const& t, InputTuple const& input, sprout::index_tuple, sprout::index_tuple ) { return sprout::tuples::remake( t, sprout::tuples::get(input)..., sprout::tuples::get(t)... ); } template inline SPROUT_CONSTEXPR typename std::enable_if< (sprout::tuples::tuple_size::value > sprout::tuples::tuple_size::value), typename sprout::tuples::results::copy::type >::type copy(Tuple const& t, InputTuple const& input) { return sprout::tuples::detail::copy_impl::type>( t, input, sprout::index_range::value, sprout::tuples::tuple_size::value>::make(), sprout::tuple_indexes::make() ); } template inline SPROUT_CONSTEXPR typename std::enable_if< !(sprout::tuples::tuple_size::value > sprout::tuples::tuple_size::value), typename sprout::tuples::results::copy::type >::type copy(Tuple const& t, InputTuple const& input) { return sprout::tuples::detail::copy_impl::type>( t, input, sprout::index_tuple<>(), sprout::tuple_indexes::make() ); } } // namespace detail // // copy // template inline SPROUT_CONSTEXPR typename sprout::tuples::results::copy::type copy(Tuple const& t, InputTuple const& input) { return sprout::tuples::detail::copy(t, input); } } // namespace tuples } // namespace sprout #endif // #ifndef SPROUT_TUPLE_ALGORITHM_COPY_HPP