Argument's number of values managing class.
More...
#include <range.hpp>
|
| range () |
| Default constructor: creates range [1, 1].
|
|
| range (const count_type n) |
| Exact count constructor: creates range [n, n].
|
|
| range (const count_type lower_bound, const count_type upper_bound) |
| Concrete range constructor: creates range [lower_bound, upper_bound].
|
|
| range (const range &)=default |
|
| range (range &&)=default |
|
range & | operator= (const range &)=default |
|
range & | operator= (range &&)=default |
|
bool | is_bound () const noexcept |
| Returns true if at least one bound (lower, upper) is set. Otherwise returns false
|
|
std::weak_ordering | ordering (const range::count_type n) const noexcept |
| Determines the ordering of the count against a range instance.
|
|
|
std::ostream & | operator<< (std::ostream &os, const range &r) noexcept |
|
range | at_least (const count_type) noexcept |
| range class builder function. Creates a range [n, inf].
|
|
range | more_than (const count_type) noexcept |
| range class builder function. Creates a range [n + 1, inf].
|
|
range | less_than (const count_type) noexcept |
| range class builder function. Creates a range [0, n - 1].
|
|
range | up_to (const count_type) noexcept |
| range class builder function. Creates a range [0, n].
|
|
range | any () noexcept |
| range class builder function. Creates a range [0, inf].
|
|
Argument's number of values managing class.
Definition at line 18 of file range.hpp.
◆ count_type
using ap::nargs::range::count_type = std::size_t |
◆ range() [1/3]
ap::nargs::range::range |
( |
| ) |
|
|
inline |
Default constructor: creates range [1, 1].
Definition at line 23 of file range.hpp.
◆ range() [2/3]
ap::nargs::range::range |
( |
const count_type |
n | ) |
|
|
inlineexplicit |
Exact count constructor: creates range [n, n].
- Parameters
-
Definition at line 29 of file range.hpp.
◆ range() [3/3]
ap::nargs::range::range |
( |
const count_type |
lower_bound, |
|
|
const count_type |
upper_bound |
|
) |
| |
|
inline |
Concrete range constructor: creates range [lower_bound, upper_bound].
- Parameters
-
lower_bound | The lower bound. |
upper_bound | The upper bound. |
Definition at line 36 of file range.hpp.
◆ is_bound()
bool ap::nargs::range::is_bound |
( |
| ) |
const |
|
inlinenoexcept |
Returns true
if at least one bound (lower, upper) is set. Otherwise returns false
Definition at line 48 of file range.hpp.
◆ ordering()
std::weak_ordering ap::nargs::range::ordering |
( |
const range::count_type |
n | ) |
const |
|
inlinenoexcept |
Determines the ordering of the count against a range instance.
For a [lower, upper]
range and the count n
the returned value is:
less
if n < lower
,
equivalent
if n >= lower
and n <= upper
,
greater
if n > upper
. If either lower
or upper
limits are not set (std::nullopt), then the corresponding conditions are dropped.
- Parameters
-
n | The value count to order. |
- Returns
- Ordering relationship between the count and the range.
Definition at line 65 of file range.hpp.
◆ any
range
class builder function. Creates a range [0, inf].
- Returns
- Built
range
class instance.
Definition at line 170 of file range.hpp.
◆ at_least
range at_least |
( |
const count_type |
n | ) |
|
|
friend |
range
class builder function. Creates a range [n, inf].
- Parameters
-
- Returns
- Built
range
class instance.
Definition at line 135 of file range.hpp.
◆ less_than
range less_than |
( |
const count_type |
n | ) |
|
|
friend |
range
class builder function. Creates a range [0, n - 1].
- Parameters
-
- Returns
- Built
range
class instance.
Definition at line 153 of file range.hpp.
◆ more_than
range more_than |
( |
const count_type |
n | ) |
|
|
friend |
range
class builder function. Creates a range [n + 1, inf].
- Parameters
-
- Returns
- Built
range
class instance.
Definition at line 144 of file range.hpp.
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const range & |
r |
|
) |
| |
|
friend |
◆ up_to
range up_to |
( |
const count_type |
n | ) |
|
|
friend |
range
class builder function. Creates a range [0, n].
- Parameters
-
- Returns
- Built
range
class instance.
Definition at line 162 of file range.hpp.
The documentation for this class was generated from the following file: