#ifndef SPROUT_DETAIL_CONTAINER_COMPLATE_BACKWARD_HPP #define SPROUT_DETAIL_CONTAINER_COMPLATE_BACKWARD_HPP #include #include #include #include #include #include namespace sprout { namespace detail { template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::container_traits::static_size == sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type container_complate_backward_2( Result const& result, Args const&... args ) { return sprout::remake(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::container_traits::static_size != sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type container_complate_backward_2( Result const& result, Args const&... args ) { return container_complate_backward_2(result, *sprout::prev(sprout::internal_end(result), sizeof...(Args) + 1), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::container_traits::static_size == sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type container_complate_backward_1( Result const& result, typename sprout::container_traits::difference_type remain, Args const&... args ) { return sprout::remake(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::container_traits::static_size != sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type container_complate_backward_1( Result const& result, typename sprout::container_traits::difference_type remain, Args const&... args ) { return remain != 0 ? container_complate_backward_1(result, remain - 1, args..., *sprout::prev(sprout::internal_end(result), remain)) : container_complate_backward_2(result, args...) ; } template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::container_traits::static_size == sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type container_complate_backward( Result const& result, Args const&... args ) { return sprout::remake(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::container_traits::static_size != sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type container_complate_backward( Result const& result, Args const&... args ) { return container_complate_backward_1(result, sprout::internal_end_offset_backward(result), args...); } } // namespace detail } // namespace sprout #endif // #ifndef SPROUT_DETAIL_CONTAINER_COMPLATE_BACKWARD_HPP