/*============================================================================= Copyright (c) 2011-2016 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef TESTSPR_RANGE_HPP #define TESTSPR_RANGE_HPP #include #include #include #include #include #include #include #include #include #include #include namespace testspr { namespace range { // // reducted_range // template::iterator>::iterator_category> class reducted_range : public sprout::adaptors::detail::adapted_range_default< Range, testspr::reduce_iterator::iterator, Category> > { public: typedef sprout::adaptors::detail::adapted_range_default< Range, testspr::reduce_iterator::iterator, Category> > base_type; typedef typename base_type::range_type range_type; typedef typename base_type::iterator iterator; public: SPROUT_CONSTEXPR reducted_range() SPROUT_DEFAULTED_DEFAULT_CONSTRUCTOR_DECL reducted_range(reducted_range const&) = default; explicit SPROUT_CONSTEXPR reducted_range(range_type& range) : base_type( iterator(sprout::end(range)), iterator(sprout::begin(range)) ) {} }; // // make_reduce_range // template inline SPROUT_CONSTEXPR testspr::range::reducted_range< typename std::remove_reference::type>::type > make_reduce_range(Range&& rng) { return testspr::range::reducted_range< typename std::remove_reference::type>::type >( sprout::lvalue_forward(rng) ); } template inline SPROUT_CONSTEXPR testspr::range::reducted_range< typename std::remove_reference::type>::type, Category > make_reduce_range(Range&& rng) { return testspr::range::reducted_range< typename std::remove_reference::type>::type, Category >( sprout::lvalue_forward(rng) ); } // // reduce_input // reduce_forward // reduce_bidirectional // reduce_random_access // template inline SPROUT_CONSTEXPR testspr::range::reducted_range< typename std::remove_reference::type>::type, std::input_iterator_tag > reduce_input(Range&& rng) { return testspr::range::make_reduce_range(SPROUT_FORWARD(Range, rng)); } template inline SPROUT_CONSTEXPR testspr::range::reducted_range< typename std::remove_reference::type>::type, std::forward_iterator_tag > reduce_forward(Range&& rng) { return testspr::range::make_reduce_range(SPROUT_FORWARD(Range, rng)); } template inline SPROUT_CONSTEXPR testspr::range::reducted_range< typename std::remove_reference::type>::type, std::bidirectional_iterator_tag > reduce_bidirectional(Range&& rng) { return testspr::range::make_reduce_range(SPROUT_FORWARD(Range, rng)); } template inline SPROUT_CONSTEXPR testspr::range::reducted_range< typename std::remove_reference::type>::type, std::random_access_iterator_tag > reduce_random_access(Range&& rng) { return testspr::range::make_reduce_range(SPROUT_FORWARD(Range, rng)); } } // namespace range } // namespace testspr namespace sprout { // // container_construct_traits // template struct container_construct_traits > : public sprout::container_construct_traits::base_type> {}; } // namespace sprout #endif // #ifndef TESTSPR_RANGE_HPP