template <typename T>
muu::integral_range struct

A half-open range of integral values (ints, enums, pointers).

Public types

using iterator = /* ... */
A read-only LegacyForwardIterator for iterating over the range.
using size_type = /* ... */
An unsigned integer type big enough to store the result of e - s.
using value_type = T
The range's value type.

Constructors, destructors, conversion operators

integral_range() defaulted noexcept
Default constructor. Does not initialize the range.
integral_range(value_type end_) constexpr noexcept
Constructs a range over [0, end).
integral_range(value_type start_, value_type end_) constexpr noexcept
Constructs a range over [start, end).
operator bool() const explicit constexpr noexcept
Returns true if the range is not empty (i.e. e > s).

Public functions

auto adjacent(const integral_range& other) const -> bool constexpr noexcept
Returns true if the range is adjacent to (but not overlapping) another range.
auto contains(value_type val) const -> bool constexpr noexcept
Returns true if the range contains a specific value.
auto contains(const integral_range& other) const -> bool constexpr noexcept
Returns true if the range contains all the values in another range.
auto empty() const -> bool constexpr noexcept
Returns true if the range is empty (i.e. e == s).
auto first() const -> value_type constexpr noexcept
Returns the first value in the range (i.e. s).
auto intersects(const integral_range& other) const -> bool constexpr noexcept
Returns true if the range intersects another range.
auto intersects_or_adjacent(const integral_range& other) const -> bool constexpr noexcept
Returns true if the range intersects or is adjacent to another range.
auto last() const -> value_type constexpr noexcept
Returns the last value in the range (i.e. e - 1).
auto size() const -> size_type constexpr noexcept
Returns the size of the range (i.e. e - s).
auto union_with(const integral_range& other) const -> integral_range constexpr noexcept
Returns the union of this range and another range.

Public variables

value_type s
The start of the range (inclusive).
value_type e
The end of the range (exclusive).

Equality

auto operator!=(const integral_range& lhs, const integral_range& rhs) -> bool constexpr noexcept
Returns true if two ranges are not equal.
auto operator==(const integral_range& lhs, const integral_range& rhs) -> bool constexpr noexcept
Returns true if two ranges are equal.

Iterators

auto begin() const -> iterator constexpr noexcept
Returns an iterator to the start of the range.
auto end() const -> iterator constexpr noexcept
Returns an iterator to the end of the range.

Iterators (ADL)

auto begin(const integral_range& range) -> iterator constexpr noexcept
Returns an iterator to the start of the range.
auto end(const integral_range& range) -> iterator constexpr noexcept
Returns an iterator to the end of the range.

Function documentation

template <typename T>
muu::integral_range::integral_range(value_type end_) constexpr noexcept

Constructs a range over [0, end).

template <typename T>
muu::integral_range::integral_range(value_type start_, value_type end_) constexpr noexcept

Constructs a range over [start, end).

Variable documentation

template <typename T>
value_type muu::integral_range::e

The end of the range (exclusive).