#ifndef SPROUT_ITERATOR_NEXT_HPP #define SPROUT_ITERATOR_NEXT_HPP #include #include #include #include namespace sprout { namespace detail { template SPROUT_CONSTEXPR typename std::enable_if< std::is_literal_type::type>::value, typename std::decay::type >::type next_impl( RandomAccessIterator&& it, std::random_access_iterator_tag* ) { return sprout::forward(it) + 1; } template SPROUT_CONSTEXPR typename std::decay::type next_impl( ForwardIterator&& it, void* ) { using std::next; return next(sprout::forward(it)); } template SPROUT_CONSTEXPR typename std::enable_if< std::is_literal_type::type>::value, typename std::decay::type >::type next_impl( RandomAccessIterator&& it, typename std::iterator_traits::type>::difference_type n, std::random_access_iterator_tag* ) { return sprout::forward(it) + n; } template SPROUT_CONSTEXPR typename std::decay::type next_impl( ForwardIterator it, typename std::iterator_traits::type>::difference_type n, void* ) { using std::next; return next(sprout::forward(it), n); } } // namespace detail // // next // template SPROUT_CONSTEXPR typename std::decay::type next(ForwardIterator&& it) { typedef typename std::iterator_traits::type>::iterator_category* category; return sprout::detail::next_impl( sprout::forward(it), category() ); } template SPROUT_CONSTEXPR typename std::decay::type next( ForwardIterator&& it, typename std::iterator_traits::type>::difference_type n ) { typedef typename std::iterator_traits::type>::iterator_category* category; return sprout::detail::next_impl( sprout::forward(it), n, category() ); } } // namespace sprout #endif // #ifndef SPROUT_ITERATOR_NEXT_HPP