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