#ifndef SPROUT_TUPLE_OPERATION_APPEND_FRONT_HPP #define SPROUT_TUPLE_OPERATION_APPEND_FRONT_HPP #include #include #include #include #include namespace sprout { namespace tuples { namespace result_of { // // append_front // template struct append_front { private: template struct apply_impl; template struct apply_impl, sprout::index_tuple > : public sprout::tuples::rebind_types< Tuple >::template apply< typename sprout::tuples::tuple_element::type..., typename sprout::tuples::tuple_element::type... > {}; public: typedef typename apply_impl< typename sprout::index_range<0, sprout::tuples::tuple_size::value>::type, typename sprout::index_range<0, sprout::tuples::tuple_size::value>::type >::type type; }; } // namespace result_of namespace detail { template SPROUT_CONSTEXPR inline Result append_front_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)... ); } } // namespace detail // // append_front // template SPROUT_CONSTEXPR inline typename sprout::tuples::result_of::append_front::type append_front( Tuple const& t, InputTuple const& input ) { return sprout::tuples::detail::append_front_impl::type>( t, input, typename sprout::index_range<0, sprout::tuples::tuple_size::value>::type(), typename sprout::index_range<0, sprout::tuples::tuple_size::value>::type() ); } } // namespace tuples } // namespace sprout #endif // #ifndef SPROUT_TUPLE_OPERATION_APPEND_FRONT_HPP