Class Subspace :: sus :: ops :: Range

template <class T>
class Range final
requires
sus::cmp::Ord<T>
{ ... };

A (half-open) range bounded inclusively below and exclusively above (start..end).

The range start..end contains all values with start <= x < end. It is empty if start >= end.

A Range can be constructed as a literal as "start..end"_r.

Static Methods

Range()
requires
sus::construct::Default<T>
Range(T start, T finish)

Methods

auto contains(const T& item) const -> bool

Returns true if item is contained in the range.

auto end_at(T t) const& -> Range<T>
requires
sus::mem::Copy<T>
auto end_at(T t) && -> Range<T>

Return a new Range that starts at where the original Range did and ends at t.

auto end_bound() const& -> Option<const T&>
auto end_bound() && -> Option<const T&>
deleted

Returns the end of the RangeBounds, exclusive of its own value.

Part of the sus::ops::RangeBounds trait.

auto is_empty() const -> bool

Returns true if the range contains no items.

The range is empty if either side is incomparable, such as f32::NAN.

auto start_at(T t) const& -> Range<T>
requires
sus::mem::Copy<T>
auto start_at(T t) && -> Range<T>

Return a new Range that starts at t and ends where the original Range did.

auto start_bound() const& -> Option<const T&>
auto start_bound() && -> Option<const T&>
deleted

Returns the beginning of the RangeBounds, inclusive of its own value.

Part of the sus::ops::RangeBounds trait.

Operators

auto operator==(const Range<T>& rhs) const -> bool
requires
sus::cmp::Eq<T>

Compares two Range for equality, satisfying the Eq concept if T satisfies Eq.

Data Members

The end of the range, exclusive of the given value.

The beginning of the range, inclusive of the given value.