23#ifndef TCLAP_RANGE_CONSTRAINT_H
24#define TCLAP_RANGE_CONSTRAINT_H
42 requires std::totally_ordered<T> &&
43 requires(std::ostream &out,
const T &value) { out << value; }
52 : _min(std::move(min)), _max(std::move(max)), _shortId() {
53 std::ostringstream os;
54 os <<
'[' << _min <<
'-' << _max <<
']';
59 std::ostringstream os;
60 os <<
"value must be between " << _min <<
" and " << _max
65 [[nodiscard]] std::string
shortID()
const override {
return _shortId; }
67 bool check(
const T &value)
const override {
69 return _min <= value && value <= _max;
The interface that defines the interaction between the Arg and Constraint.
A Constraint that requires a value to fall within a closed [min, max] range, for the common "between ...
std::string shortID() const override
Returns the short ID for the Constraint.
bool check(const T &value) const override
The method used to verify that the value parsed from the command line meets the constraint.
std::string description() const override
Returns a description of the Constraint.
RangeConstraint(T min, T max)
Constructor.