66 if (not (this->
_lower_bound.has_value() or this->_upper_bound.has_value()))
67 return std::weak_ordering::equivalent;
69 if (this->
_lower_bound.has_value() and this->_upper_bound.has_value()) {
71 return std::weak_ordering::less;
74 return std::weak_ordering::greater;
76 return std::weak_ordering::equivalent;
81 ? std::weak_ordering::less
82 : std::weak_ordering::equivalent;
85 ? std::weak_ordering::greater
86 : std::weak_ordering::equivalent;
90 if (r._lower_bound.has_value() and r._lower_bound == r._upper_bound) {
91 os << r._lower_bound.value();
95 if (not r._lower_bound.has_value() and not r._upper_bound.has_value()) {
100 os <<
"[" << r._lower_bound.value_or(0ull) <<
", ";
101 if (r._upper_bound.has_value())
102 os << r._upper_bound.value() <<
"]";
136 return range(n, std::nullopt);
145 return range(n + 1, std::nullopt);
154 return range(std::nullopt, n - 1);
163 return range(std::nullopt, n);
171 return range(std::nullopt, std::nullopt);
Argument's number of values managing class.
std::optional< count_type > _lower_bound
range()
Default constructor: creates range [1, 1].
range & operator=(range &&)=default
range(const range &)=default
range & operator=(const range &)=default
range(const count_type n)
Exact count constructor: creates range [n, n].
std::optional< count_type > _upper_bound
friend range at_least(const count_type) noexcept
range class builder function. Creates a range [n, inf].
friend range any() noexcept
range class builder function. Creates a range [0, inf].
std::weak_ordering ordering(const range::count_type n) const noexcept
Determines the ordering of the count against a range instance.
friend range less_than(const count_type) noexcept
range class builder function. Creates a range [0, n - 1].
friend range more_than(const count_type) noexcept
range class builder function. Creates a range [n + 1, inf].
friend std::ostream & operator<<(std::ostream &os, const range &r) noexcept
range(const count_type lower_bound, const count_type upper_bound)
Concrete range constructor: creates range [lower_bound, upper_bound].
static constexpr count_type _default_bound
friend range up_to(const count_type) noexcept
range class builder function. Creates a range [0, n].
bool is_bound() const noexcept
Returns true if at least one bound (lower, upper) is set. Otherwise returns false
range up_to(const range::count_type n) noexcept
range class builder function. Creates a range [0, n].
range more_than(const range::count_type n) noexcept
range class builder function. Creates a range [n + 1, inf].
range any() noexcept
range class builder function. Creates a range [0, inf].
range less_than(const range::count_type n) noexcept
range class builder function. Creates a range [0, n - 1].
range at_least(const range::count_type n) noexcept
range class builder function. Creates a range [n, inf].