Implements a subrange by providing start and end iterators on another range.
More...
#include <detray/utils/ranges/subrange.hpp>
|
|
using | const_iterator_t = typename detray::ranges::const_iterator_t<range_t> |
| | Iterator type used when accessing a const view.
|
|
using | difference_t = typename detray::ranges::range_difference_t<range_t> |
| | Difference type used for range positions.
|
|
using | iterator_t = typename detray::ranges::iterator_t<range_t> |
| | Iterator type used to delimit the range.
|
|
|
constexpr | subrange_view ()=default |
| | Default constructor.
|
| constexpr | subrange_view (iterator_t start, iterator_t end) |
| | Construct from an start and end iterator pair.
|
| constexpr auto | begin () -> iterator_t |
| | Return the first iterator.
|
| constexpr auto | begin () const -> const_iterator_t |
| | Return the first iterator of a const view.
|
| constexpr auto | end () -> iterator_t |
| | Return the end iterator.
|
| constexpr auto | end () const -> const_iterator_t |
| | Return the end iterator of a const view.
|
| constexpr auto | operator== (const subrange_view &rhs) const -> bool |
| | Equality operator.
|
| constexpr decltype(auto) | back () const |
| | Return a reference to the last element.
|
| constexpr auto | data () const |
| | Return a pointer to the first element, or null for an empty view.
|
| constexpr auto | empty () const -> bool |
| | Check whether the view contains no elements.
|
| constexpr decltype(auto) | front () const |
| | Return a reference to the first element.
|
| constexpr | operator bool () const |
| | Test whether the view contains at least one element.
|
| constexpr decltype(auto) | operator[] (const dindex i) const |
| | Subscript operator that takes detray dindex.
|
| constexpr auto | size () const |
| | Return the number of elements in the view.
|
Implements a subrange by providing start and end iterators on another range.
- See also
- https://en.cppreference.com/w/cpp/ranges/subrange
- Template Parameters
-
| range_t | the iterable which to constrain to a subrange. |
◆ subrange_view()
Construct from an start and end iterator pair.
- Parameters
-
| start | First iterator in the view. |
| end | End iterator of the view. |
◆ begin() [1/2]
Return the first iterator.
- Returns
- start position of range.
◆ begin() [2/2]
Return the first iterator of a const view.
- Returns
- start position of the range - const
◆ end() [1/2]
Return the end iterator.
- Returns
- sentinel of the range.
◆ end() [2/2]
Return the end iterator of a const view.
- Returns
- sentinel of the range.
◆ operator==()
Equality operator.
- Parameters
-
| rhs | the subrange to compare with |
- Returns
- whether the two subranges are equal