46 throw std::logic_error(
47 std::format(
"Invalid range bounds: lower = {}, upper = {}", lower, upper)
80 [[nodiscard]]
friend constexpr std::weak_ordering
operator<=>(
83 if (n < r._lower_bound)
84 return std::weak_ordering::less;
86 if (n > r._upper_bound)
87 return std::weak_ordering::greater;
89 return std::weak_ordering::equivalent;
93 if (not r.is_explicitly_bound()) {
98 if (r.is_exactly_bound()) {
103 os <<
"[" << r._lower_bound <<
", ";
104 if (r.has_explicit_upper_bound())
105 os << r._upper_bound <<
"]";
116 friend constexpr range any() noexcept;
Argument's number of values managing class.
friend constexpr range more_than(const count_type) noexcept
range class builder function. Creates a range [n + 1, inf).
constexpr bool is_explicitly_bound() const noexcept
friend constexpr std::weak_ordering operator<=>(const count_type n, const range &r) noexcept
Determines the ordering of the count against a range instance.
constexpr range(const count_type n)
Exact count constructor: creates range [n, n].
friend constexpr range up_to(const count_type) noexcept
range class builder function. Creates a range [0, n].
constexpr bool has_explicit_lower_bound() const noexcept
friend constexpr range at_least(const count_type) noexcept
range class builder function. Creates a range [n, inf).
friend constexpr range less_than(const count_type) noexcept
range class builder function. Creates a range [0, n - 1].
constexpr range()=default
Default constructor: creates an unbound range.
friend std::ostream & operator<<(std::ostream &os, const range &r) noexcept
constexpr bool is_exactly_bound() const noexcept
constexpr bool operator==(const range &other) const =default
constexpr bool has_explicit_upper_bound() const noexcept
constexpr range(const count_type lower, const count_type upper)
Concrete range constructor: creates range [lower, upper].
friend constexpr range any() noexcept
range class builder function. Creates a range [0, inf].
constexpr count_type min_bound
The minimum bound for the nargs::range class.
constexpr count_type max_bound
The maximum bound for the nargs::range class.