Range-v3
Range algorithms, views, and actions for the Standard Library
ranges::view_facade< Derived, Cardinality > Struct Template Reference

Description

template<typename Derived, cardinality Cardinality>
struct ranges::view_facade< Derived, Cardinality >

A utility for constructing a view from a (derived) type that implements begin and end cursors.

Template Parameters
DerivedA type that derives from view_facade and implements begin and end cursors. This type is permitted to be incomplete.
CardinalityThe cardinality of this view: finite, infinite, or unknown. See ranges::cardinality.
+ Inheritance diagram for ranges::view_facade< Derived, Cardinality >:

Instances and minimal complete definitions

struct  view_as_cursor
 

Public Member Functions

template<typename D = Derived>
constexpr auto begin () -> detail::facade_iterator_t< D > requires same_as< D, Derived >
 Let d be static_cast<Derived &>(*this). Let b be std::as_const(d).begin_cursor() if that expression is well-formed; otherwise, let b be d.begin_cursor(). Let B be the type of b. More...
 
template<typename D = Derived>
constexpr auto begin () const -> detail::facade_iterator_t< D const > requires same_as< D, Derived >
 
template<typename D = Derived>
constexpr auto end () -> detail::facade_sentinel_t< D > requires same_as< D, Derived >
 Let d be static_cast<Derived &>(*this). Let e be std::as_const(d).end_cursor() if that expression is well-formed; otherwise, let e be d.end_cursor(). Let E be the type of e. More...
 
template<typename D = Derived>
constexpr auto end () const -> detail::facade_sentinel_t< D const > requires same_as< D, Derived >
 
- Public Member Functions inherited from ranges::view_interface< Derived, Cardinality >
template<bool True = true>
constexpr auto at (range_difference_t< D< True >> n) -> range_reference_t< D< True >> requires True &&random_access_range< D< True >> &&sized_range< D< True >>
 Returns a reference to the element at specified location pos, with bounds checking.
 
template<bool True = true>
constexpr auto at (range_difference_t< D< True >> n) const -> range_reference_t< D< True > const > requires True &&random_access_range< D< True > const > &&sized_range< D< True > const >
 
template<bool True = true>
constexpr auto back () -> range_reference_t< D< True >> requires True &&common_range< D< True >> &&bidirectional_range< D< True >>
 Access the last element in a range:
 
template<bool True = true>
constexpr auto back () const -> range_reference_t< D< True > const > requires True &&common_range< D< True > const > &&bidirectional_range< D< True > const >
 
constexpr auto empty () const noexcept -> bool requires(detail::has_fixed_size_(Cardinality))
 
template<bool True = true>
constexpr auto empty () noexcept(noexcept(bool(ranges::size(std::declval< D< True > & >())==0))) -> bool requires True &&(Cardinality< 0) &&(Cardinality !=infinite) &&(!forward_range< D< True >>)&&sized_range< D< True >>
 
template<bool True = true>
constexpr auto empty () const noexcept(noexcept(bool(ranges::size(std::declval< D< True > const & >())==0))) -> bool requires True &&(Cardinality< 0) &&(Cardinality !=infinite) &&(!forward_range< D< True > const >)&&sized_range< D< True > const >
 
template<bool True = true>
constexpr auto empty () noexcept(noexcept(bool(ranges::begin(std::declval< D< True > & >())==ranges::end(std::declval< D< True > & >())))) -> bool requires True &&(!detail::has_fixed_size_(Cardinality)) &&forward_range< D< True >>
 
template<bool True = true>
constexpr auto empty () const noexcept(noexcept(bool(ranges::begin(std::declval< D< True > const & >())==ranges::end(std::declval< D< True > const & >())))) -> bool requires True &&(!detail::has_fixed_size_(Cardinality)) &&forward_range< D< True > const >
 
template<bool True = true, typename Slice = views::slice_fn>
requires True && forward_range (input_range< D< True > & > &&sized_range< D< True > & >)) const expr auto operator[](detail
 
template<bool True = true, typename Slice = views::slice_fn>
requires True && forward_range (input_range< D< True > const & > &&sized_range< D< True > const & >)) const expr auto operator[](detail
 
template<bool True = true, typename Slice = views::slice_fn>
requires True && forward_range (input_range< D< True >> &&sized_range< D< True >>)) const expr auto operator[](detail
 
template<bool True = true, typename Slice = views::slice_fn>
requires True && forward_range (input_range< D< True > & > &&sized_range< D< True > & >)) const expr auto operator[](detail
 
template<bool True = true, typename Slice = views::slice_fn>
requires True && forward_range (input_range< D< True > const & > &&sized_range< D< True > const & >)) const expr auto operator[](detail
 
template<bool True = true, typename Slice = views::slice_fn>
requires True && forward_range (input_range< D< True >> &&sized_range< D< True >>)) const expr auto operator[](detail
 
template<bool True = true>
constexpr auto front () -> range_reference_t< D< True >> requires True &&forward_range< D< True >>
 Access the first element in a range:
 
template<bool True = true>
constexpr auto front () const -> range_reference_t< D< True > const > requires True &&forward_range< D< True > const >
 
template<bool True = true>
requires True &&detail::can_empty_< D< True > > constexpr operator bool () noexcept(noexcept(ranges::empty(std::declval< D< True > & >())))
 
template<bool True = true>
requires True &&detail::can_empty_< D< True > const > constexpr operator bool () const noexcept(noexcept(ranges::empty(std::declval< D< True > const & >())))
 
view_interfaceoperator= (view_interface &&)=default
 
view_interfaceoperator= (view_interface const &)=default
 
template<bool True = true>
constexpr auto operator[] (range_difference_t< D< True >> n) -> range_reference_t< D< True >> requires True &&random_access_range< D< True >>
 Simple indexing:
 
template<bool True = true>
constexpr auto operator[] (range_difference_t< D< True >> n) const -> range_reference_t< D< True > const > requires True &&random_access_range< D< True > const >
 
template<bool True = true, typename Slice = views::slice_fn>
requires True &&input_range< D< True > & > constexpr auto operator[] (detail::slice_bounds< range_difference_t< D< True >>> offs) &
 Python-ic slicing:
 
template<bool True = true, typename Slice = views::slice_fn>
requires True &&input_range< D< True > const & > constexpr auto operator[] (detail::slice_bounds< range_difference_t< D< True >>> offs) const &
 
template<bool True = true, typename Slice = views::slice_fn>
requires True &&input_range< D< True > > constexpr auto operator[] (detail::slice_bounds< range_difference_t< D< True >>> offs) &&
 
template<bool True = true, typename Slice = views::slice_fn>
requires True &&input_range< D< True > & > &&sized_range< D< True > & > constexpr auto operator[] (detail::slice_bounds< range_difference_t< D< True >>, detail::from_end_of_t< D< True >>> offs) &
 
template<bool True = true, typename Slice = views::slice_fn>
requires True &&input_range< D< True > const & > &&sized_range< D< True > const & > constexpr auto operator[] (detail::slice_bounds< range_difference_t< D< True >>, detail::from_end_of_t< D< True >>> offs) const &
 
template<bool True = true, typename Slice = views::slice_fn>
requires True &&input_range< D< True > > &&sized_range< D< True > > constexpr auto operator[] (detail::slice_bounds< range_difference_t< D< True >>, detail::from_end_of_t< D< True >>> offs) &&
 
template<bool True = true, typename Slice = views::slice_fn>
requires True &&input_range< D< True > & > constexpr auto operator[] (detail::slice_bounds< range_difference_t< D< True >>, end_fn > offs) &
 
template<bool True = true, typename Slice = views::slice_fn>
requires True &&input_range< D< True > const & > constexpr auto operator[] (detail::slice_bounds< range_difference_t< D< True >>, end_fn > offs) const &
 
template<bool True = true, typename Slice = views::slice_fn>
requires True &&input_range< D< True > > constexpr auto operator[] (detail::slice_bounds< range_difference_t< D< True >>, end_fn > offs) &&
 
template<bool True = true>
constexpr auto size () -> detail::iter_size_t< iterator_t< D< True >>> requires True &&(Cardinality< 0) &&sized_sentinel_for< sentinel_t< D< True >>, iterator_t< D< True >>> &&forward_range< D< True >>
 If sized_sentinel_for<sentinel_t<Derived>, iterator_t<Derived>> is satisfied, and if Derived is a forward_range, then return end - begin cast to an unsigned integer.
 
template<bool True = true>
constexpr auto size () const -> detail::iter_size_t< iterator_t< D< True >>> requires True &&(Cardinality< 0) &&sized_sentinel_for< sentinel_t< D< True > const >, iterator_t< D< True > const >> &&forward_range< D< True > const >
 
 view_interface (view_interface &&)=default
 
 view_interface (view_interface const &)=default
 

Protected Member Functions

constexpr view_as_cursor begin_cursor () const
 
constexpr default_sentinel_t end_cursor () const
 
- Protected Member Functions inherited from ranges::view_interface< Derived, Cardinality >
constexpr Derivedderived () noexcept
 
constexpr Derived const & derived () const noexcept
 

Protected Attributes

friend range_access
 

Additional Inherited Members

- Static Public Member Functions inherited from ranges::view_interface< Derived, Cardinality >
template<bool True = true, int = 42>
static constexpr auto size () noexcept -> std::size_t requires True &&(Cardinality >=0)
 If the size of the range is known at compile-time and finite, return it.
 
- Protected Types inherited from ranges::view_interface< Derived, Cardinality >
template<bool B>
using D = meta::invoke< detail::dependent_< B >, Derived >
 

Member Function Documentation

◆ begin() [1/2]

template<typename Derived, cardinality Cardinality>
template<typename D = Derived>
constexpr auto ranges::view_facade< Derived, Cardinality >::begin ( ) -> detail::facade_iterator_t<D> requires same_as<D, Derived>

Let d be static_cast<Derived &>(*this). Let b be std::as_const(d).begin_cursor() if that expression is well-formed; otherwise, let b be d.begin_cursor(). Let B be the type of b.

Returns
ranges::basic_iterator<B>(b)

◆ begin() [2/2]

template<typename Derived, cardinality Cardinality>
template<typename D = Derived>
constexpr auto ranges::view_facade< Derived, Cardinality >::begin ( ) const -> detail::facade_iterator_t<D const> requires same_as<D, Derived>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ end() [1/2]

template<typename Derived, cardinality Cardinality>
template<typename D = Derived>
constexpr auto ranges::view_facade< Derived, Cardinality >::end ( ) -> detail::facade_sentinel_t<D> requires same_as<D, Derived>

Let d be static_cast<Derived &>(*this). Let e be std::as_const(d).end_cursor() if that expression is well-formed; otherwise, let e be d.end_cursor(). Let E be the type of e.

Returns
ranges::basic_iterator<E>(e) if E is the same as B computed above for begin(); otherwise, return e.

◆ end() [2/2]

template<typename Derived, cardinality Cardinality>
template<typename D = Derived>
constexpr auto ranges::view_facade< Derived, Cardinality >::end ( ) const -> detail::facade_sentinel_t<D const> requires same_as<D, Derived>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.