#ifndef SPROUT_TUPLE_ALGORITHM_COPY_HPP #define SPROUT_TUPLE_ALGORITHM_COPY_HPP #include #include #include #include #include namespace sprout { namespace tuples { namespace result_of { // // copy // template struct copy { public: typedef typename sprout::tuples::tuple_construct_traits::copied_type type; }; } // namespace result_of 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::result_of::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::index_range<0, sprout::tuples::tuple_size::value>::make() ); } template inline SPROUT_CONSTEXPR typename std::enable_if< !(sprout::tuples::tuple_size::value > sprout::tuples::tuple_size::value), typename sprout::tuples::result_of::copy::type >::type copy(Tuple const& t, InputTuple const& input) { return sprout::tuples::detail::copy_impl::type>( t, input, sprout::index_tuple<>(), sprout::index_range<0, sprout::tuples::tuple_size::value>::make() ); } } // namespace detail // // copy // template inline SPROUT_CONSTEXPR typename sprout::tuples::result_of::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