#include <muu/integral_range.h>
template <typename T>
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
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).