Header file range/v3/view/slice.hpp

#include <meta/meta.hpp>

#include <range/v3/range_fwd.hpp>

#include <range/v3/range_traits.hpp>

#include <range/v3/range_concepts.hpp>

#include <range/v3/view_interface.hpp>

#include <range/v3/iterator_range.hpp>

#include <range/v3/utility/optional.hpp>

#include <range/v3/utility/functional.hpp>

#include <range/v3/utility/iterator_traits.hpp>

#include <range/v3/utility/counted_iterator.hpp>

#include <range/v3/utility/static_const.hpp>

#include <range/v3/view/all.hpp>

#include <range/v3/view/counted.hpp>

#include <range/v3/view/drop_exactly.hpp>

#include <range/v3/view/view.hpp>

namespace ranges
{
    inline namespace v3
    {
        namespace detail
        {
            template <typename Rng, typename Int>
            range_iterator_t<Rng> pos_at_(Rng&& rng, Int i, concepts::InputRange*, std::true_type);
            
            template <typename Rng, typename Int>
            range_iterator_t<Rng> pos_at_(Rng&& rng, Int i, concepts::BidirectionalRange*, std::false_type);
            
            template <typename Rng, typename Int>
            range_iterator_t<Rng> pos_at_(Rng&& rng, Int i, concepts::InputRange*, std::false_type);
            
            template <typename Rng, bool IsRandomAccess = RandomAccessRange<Rng>()>
            struct slice_view_
            : view_facade<slice_view<Rng>, finite>
            {
                slice_view_() = default;
                
                slice_view_(slice_view_&& that);
                
                slice_view_(slice_view_const& that);
                
                slice_view_(Rng rng, difference_type_ from, difference_type_ count);
                
                slice_view_& operator=(slice_view_&& that);
                
                slice_view_& operator=(slice_view_const& that);
                
                range_size_t<Rng> size() const;
                
                Rng& base();
                
                Rng const& base() const;
            };
            
            template <typename Rng>
            struct slice_view_<Rng, true>
            : view_interface<slice_view<Rng>, finite>
            {
                slice_view_() = default;
                
                slice_view_(Rng rng, difference_type_ from, difference_type_ count);
                
                range_iterator_t<Rng> begin();
                
                range_iterator_t<Rng> end();
                
                template <typename BaseRng = Rng, int _concept_requires_163 = 42, typename std::enable_if<(_concept_requires_163==43)||(Range<BaseRng const>()), int>::type=0>
                range_iterator_t<BaseRng const> begin() const;
                
                template <typename BaseRng = Rng, int _concept_requires_170 = 42, typename std::enable_if<(_concept_requires_170==43)||(Range<BaseRng const>()), int>::type=0>
                range_iterator_t<BaseRng const> end() const;
                
                range_size_t<Rng> size() const;
                
                Rng& base();
                
                Rng const& base() const;
            };
        }
        
        namespace adl_begin_end_detail
        {
            template <typename Int, int _concept_requires_195 = 42, typename std::enable_if<(_concept_requires_195==43)||(Integral<Int>()), int>::type=0>
            detail::from_end_<meta::_t<std::make_signed<Int>>> operator-(end_fn, Int dist);
        }
        
        template <typename Rng>
        struct slice_view;
        
        namespace view
        {
            struct slice_fn
            {
                template <typename Rng, int _concept_requires_272 = 42, typename std::enable_if<(_concept_requires_272==43)||(InputRange<Rng>()), int>::type=0>
                decltype(slice_fn::invoke_(std::forward<Rng>(rng), from, to-from, range_concept<Rng>{})) operator()(Rng&& rng, range_difference_t<Rng> from, range_difference_t<Rng> to) const;
                
                template <typename Rng, int _concept_requires_286 = 42, typename std::enable_if<(_concept_requires_286==43)||(InputRange<Rng>()&&SizedRange<Rng>()), int>::type=0>
                decltype(slice_fn::invoke_(std::forward<Rng>(rng), from, distance(rng)+to.dist_-from, range_concept<Rng>{})) operator()(Rng&& rng, range_difference_t<Rng> from, detail::from_end_<range_difference_t<Rng>> to) const;
                
                template <typename Rng, int _concept_requires_301 = 42, typename std::enable_if<(_concept_requires_301==43)||((InputRange<Rng>()&&SizedRange<Rng>())||ForwardRange<Rng>()), int>::type=0>
                decltype(slice_fn::invoke_(std::forward<Rng>(rng), from.dist_, to.dist_-from.dist_, range_concept<Rng>{}, bounded_range_concept<Rng>{}())) operator()(Rng&& rng, detail::from_end_<range_difference_t<Rng>> from, detail::from_end_<range_difference_t<Rng>> to) const;
                
                template <typename Rng, int _concept_requires_318 = 42, typename std::enable_if<(_concept_requires_318==43)||(InputRange<Rng>()), int>::type=0>
                decltype(ranges::view::drop_exactly(std::forward<Rng>(rng), from)) operator()(Rng&& rng, range_difference_t<Rng> from, end_fn) const;
                
                template <typename Rng, int _concept_requires_327 = 42, typename std::enable_if<(_concept_requires_327==43)||((InputRange<Rng>()&&SizedRange<Rng>())||ForwardRange<Rng>()), int>::type=0>
                decltype(slice_fn::invoke_(std::forward<Rng>(rng), from.dist_, -from.dist_, range_concept<Rng>{}, bounded_range_concept<Rng>{}())) operator()(Rng&& rng, detail::from_end_<range_difference_t<Rng>> from, end_fn) const;
                
                template <typename Rng, int _concept_requires_350 = 42, typename std::enable_if<(_concept_requires_350==43)||(!InputRange<Rng>()), int>::type=0>
                void operator()(Rng&&, range_difference_t<Rng>, range_difference_t<Rng>) const;
                
                template <typename Rng, int _concept_requires_358 = 42, typename std::enable_if<(_concept_requires_358==43)||(!(InputRange<Rng>()&&SizedRange<Rng>())), int>::type=0>
                void operator()(Rng&&, range_difference_t<Rng>, detail::from_end_<range_difference_t<Rng>>) const;
                
                template <typename Rng, int _concept_requires_371 = 42, typename std::enable_if<(_concept_requires_371==43)||(!((InputRange<Rng>()&&SizedRange<Rng>())||ForwardRange<Rng>())), int>::type=0>
                void operator()(Rng&&, detail::from_end_<range_difference_t<Rng>>, detail::from_end_<range_difference_t<Rng>>) const;
                
                template <typename Rng, int _concept_requires_385 = 42, typename std::enable_if<(_concept_requires_385==43)||(!(InputRange<Rng>())), int>::type=0>
                void operator()(Rng&&, range_difference_t<Rng>, end_fn) const;
                
                template <typename Rng, int _concept_requires_393 = 42, typename std::enable_if<(_concept_requires_393==43)||(!((InputRange<Rng>()&&SizedRange<Rng>())||ForwardRange<Rng>())), int>::type=0>
                void operator()(Rng&&, detail::from_end_<range_difference_t<Rng>>, end_fn) const;
            };
            
            inline namespace 
            {
                constexpr auto& slice = static_const<view<slice_fn>>::value;
            }
        }
    }
}

Class template ranges::v3::slice_view<Rng>

template <typename Rng>
struct slice_view
: detail::slice_view_<Rng>
{
    using detail::slice_view_<Rng>::slice_view_;
};

@{