#ifndef SPROUT_ALGORITHM_STRING_JOIN_HPP #define SPROUT_ALGORITHM_STRING_JOIN_HPP #include #include #include #include #include #include #include namespace sprout { namespace algorithm { namespace result_of { // // join // template struct join { public: typedef typename sprout::rebind_fixed_size< typename sprout::fixed_container_traits::value_type >::template apply< sprout::fixed_container_traits< typename sprout::fixed_container_traits::value_type >::fixed_size * sprout::fixed_container_traits::fixed_size >::type type; }; } // namespace result_of namespace detail { template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size == sizeof...(Args), Result >::type join_impl( ContainerInputIterator first_cont, ContainerInputIterator last_cont, Args const&... args ); template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size != sizeof...(Args), Result >::type join_impl( ContainerInputIterator first_cont, ContainerInputIterator last_cont, Args const&... args ); template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size == sizeof...(Args), Result >::type join_impl_1( ContainerInputIterator first_cont, ContainerInputIterator last_cont, InputIterator first, InputIterator last, Args const&... args ) { return sprout::make_clone(args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size != sizeof...(Args), Result >::type join_impl_1( ContainerInputIterator first_cont, ContainerInputIterator last_cont, InputIterator first, InputIterator last, Args const&... args ) { return first != last ? sprout::algorithm::detail::join_impl_1(first_cont, last_cont, sprout::next(first), last, args..., *first) : sprout::algorithm::detail::join_impl(sprout::next(first_cont), last_cont, args...) ; } template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size == sizeof...(Args), Result >::type join_impl( ContainerInputIterator first_cont, ContainerInputIterator last_cont, Args const&... args ) { return sprout::make_clone(args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size != sizeof...(Args), Result >::type join_impl( ContainerInputIterator first_cont, ContainerInputIterator last_cont, Args const&... args ) { return first_cont != last_cont ? sprout::algorithm::detail::join_impl_1(first_cont, last_cont, sprout::begin(*first_cont), sprout::end(*first_cont), args...) : sprout::make_clone(args...) ; } } // namespace detail // // join // template SPROUT_CONSTEXPR inline typename sprout::algorithm::result_of::join::type join( ContainerContainer const& cont_cont ) { return sprout::algorithm::detail::join_impl::type>( sprout::begin(cont_cont), sprout::end(cont_cont) ); } } // namespace algorithm } // namespace sprout #endif // #ifndef SPROUT_ALGORITHM_STRING_JOIN_HPP