A DiscreteRange is a Range where the underlying endpoints are integral (discrete, not continuous); this implies you can iterate over the members of the range, and its endpoints are closed. More...
#include <DiscreteRange.h>
Public Member Functions | |
constexpr | DiscreteRange ()=default |
constexpr Range< T, TRAITS > | Intersection (const Range< T, TRAITS > &rhs) const |
constexpr Range< T, TRAITS > | UnionBounds (const Range< T, TRAITS > &rhs) const |
constexpr UnsignedDifferenceType | GetNumberOfContainedPoints () const |
constexpr DiscreteRange | Offset (SignedDifferenceType o) const |
nonvirtual Iterable< T > | Elements () const |
nonvirtual | operator Iterable< T > () const |
nonvirtual Iterator< T > | begin () const |
![]() | |
constexpr | Range () |
constexpr Range | ReplaceStart (Common::ArgByValueType< T > start) const |
Construct a new Range from this, but with the given start. | |
constexpr Range | ReplaceEnd (Common::ArgByValueType< T > end) const |
Construct a new Range from this, but with the given end. | |
constexpr bool | empty () const |
constexpr | operator bool () const |
equivalent to not this->empty (); | |
constexpr UnsignedDifferenceType | GetDistanceSpanned () const |
constexpr T | GetMidpoint () const |
constexpr T | Pin (T v) const |
constexpr bool | Contains (Common::ArgByValueType< T > r) const |
nonvirtual constexpr Range | Closure () const |
constexpr bool | operator== (const Range &rhs) const |
constexpr optional< bool > | DefinitelyLessThan (const Range &rhs) const |
Compute a less-like notion for Range. | |
template<typename T2 , typename TRAITS2 > | |
constexpr bool | Intersects (const Range< T2, TRAITS2 > &rhs) const |
constexpr Range | Intersection (const Range &rhs) const |
nonvirtual DisjointRange< T, Range > | Union (const Range &rhs) const |
constexpr Range | UnionBounds (const Range &rhs) const |
constexpr Range | Extend (Common::ArgByValueType< T > value) const |
constexpr T | GetLowerBound () const |
constexpr T | GetUpperBound () const |
constexpr Range | Offset (SignedDifferenceType o) const |
constexpr Range | Times (T o) const |
nonvirtual Characters::String | ToString (const function< Characters::String(const T &)> &elt2String=[](const T &x) -> Characters::String { return Characters::ToString(x);}) const |
Static Public Member Functions | |
static constexpr DiscreteRange | FullRange () |
![]() | |
static constexpr Range | Ball (Common::ArgByValueType< T > center, Common::ArgByValueType< UnsignedDifferenceType > radius, Openness lhsOpen=TRAITS::kLowerBoundOpenness, Openness rhsOpen=TRAITS::kUpperBoundOpenness) |
returns a range centered around center, with the given radius (and optionally argument openness). | |
static constexpr Range | ContainedRange (Common::ArgByValueType< T > begin, Common::ArgByValueType< T > end) |
static constexpr Range | FullRange () |
Additional Inherited Members | |
![]() | |
using | value_type = T |
Range::value_type is the type of the contained elements of the range (say range of integers, value_type=int) | |
A DiscreteRange is a Range where the underlying endpoints are integral (discrete, not continuous); this implies you can iterate over the members of the range, and its endpoints are closed.
DiscreteRange<> is an immutable type (once constructed, will never change), except for allowing operator=..
Definition at line 75 of file DiscreteRange.h.
|
explicitconstexprdefault |
DiscreteRange () with no arguments produces an empty sequence.
|
staticconstexpr |
Like Range<>::FullRange () but returning a DiscreteRange<> type.
Definition at line 158 of file DiscreteRange.inl.
|
constexpr |
Like Range<>::Intersection (), but returning a DiscreteRange<> type.
Definition at line 163 of file DiscreteRange.inl.
|
constexpr |
Like Range<>::UnionBounds (), but returning a DiscreteRange<> type.
Definition at line 173 of file DiscreteRange.inl.
|
constexpr |
This returns the number of points from lower bound to upper bound inclusive. This equals GetDistanceSpanned () + 1 (roughly). If (empty ()) .... this returns 0;
Definition at line 184 of file DiscreteRange.inl.
|
constexpr |
Definition at line 194 of file DiscreteRange.inl.
Iterable< T > Stroika::Foundation::Traversal::DiscreteRange< T, TRAITS >::Elements | ( | ) | const |
Elements () makes no guarantees about whether or not modifications to the underlying DisjointDiscreteRange<> will appear in the Elements() Iterable<T>.
Definition at line 200 of file DiscreteRange.inl.
Stroika::Foundation::Traversal::DiscreteRange< T, TRAITS >::operator Iterable< T > | ( | ) | const |
Definition at line 205 of file DiscreteRange.inl.
Iterator< T > Stroika::Foundation::Traversal::DiscreteRange< T, TRAITS >::begin | ( | ) | const |
Definition at line 210 of file DiscreteRange.inl.