Header file range/v3/view_facade.hpp

#include <meta/meta.hpp>

#include <range/v3/range_fwd.hpp>

#include <range/v3/range_access.hpp>

#include <range/v3/view_interface.hpp>

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

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

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

namespace ranges
{
    inline namespace v3
    {
        namespace detail
        {
            template <typename Derived>
            using begin_cursor_t = decltype(range_access::begin_cursor(std::declval<Derived&>(), 42));
            
            template <typename Derived>
            using end_cursor_t = decltype(range_access::end_cursor(std::declval<Derived&>(), 42));
            
            template <typename Derived>
            using facade_iterator_t = basic_iterator<begin_cursor_t<Derived>, end_cursor_t<Derived>>;
            
            template <typename Derived>
            using facade_sentinel_t = meta::if_<Same<begin_cursor_t<Derived>, end_cursor_t<Derived>>, basic_iterator<begin_cursor_t<Derived>, end_cursor_t<Derived>>, basic_sentinel<end_cursor_t<Derived>>>;
        }
        
        template <typename Derived, cardinality Cardinality>
        struct view_facade;
        
        template <typename RangeFacade>
        using view_facade_t = meta::_t<range_access::view_facade<RangeFacade>>;
    }
}

Class template ranges::v3::view_facade<Derived, Cardinality>

template <typename Derived, cardinality Cardinality>
struct view_facade
: view_interface<Derived, Cardinality>
{
protected:
    using view_facade_t = view_facade;
    
    using view_interface<Derived, Cardinality>::derived;
    
    Derived begin_cursor() const;
    
    default_end_cursor end_cursor() const;
    
public:
    template <typename D = Derived, int _concept_requires_74 = 42, typename std::enable_if<(_concept_requires_74==43)||(Same<D, Derived>()), int>::type=0>
    detail::facade_iterator_t<D> begin();
    
    template <typename D = Derived, int _concept_requires_80 = 42, typename std::enable_if<(_concept_requires_80==43)||(Same<D, Derived>()), int>::type=0>
    detail::facade_iterator_t<D const> begin() const;
    
    template <typename D = Derived, int _concept_requires_85 = 42, typename std::enable_if<(_concept_requires_85==43)||(Same<D, Derived>()), int>::type=0>
    detail::facade_sentinel_t<D> end();
    
    template <typename D = Derived, int _concept_requires_91 = 42, typename std::enable_if<(_concept_requires_91==43)||(Same<D, Derived>()), int>::type=0>
    detail::facade_sentinel_t<D const> end() const;
};

@{