23#ifndef TCLAP_COMPARISON_CONSTRAINT_H
24#define TCLAP_COMPARISON_CONSTRAINT_H
40 std::totally_ordered<T> &&
41 requires(std::ostream &out,
const T &value) { out << value; };
44template <
class T,
class Compare>
48 template <
class Bound>
49 requires std::constructible_from<T, Bound &&>
51 const std::string &symbol)
52 : _bound(std::forward<Bound>(bound)), _relation(relation), _shortId() {
53 std::ostringstream out;
54 out <<
'[' << symbol << _bound <<
']';
58 bool operator()(
const T &value)
const {
return Compare()(value, _bound); }
60 std::ostringstream out;
61 out <<
"value must be " << _relation <<
' ' << _bound;
64 std::string
shortID()
const {
return _shortId; }
68 std::string _relation;
72template <
class T,
class Compare>
73 requires OrderedConstraintValue<T>
78 template <
class Bound>
79 requires std::constructible_from<T, Bound &&>
81 const std::string &symbol)
100 requires internal::OrderedConstraintValue<T>
104 template <
class Bound>
105 requires std::constructible_from<T, Bound &&>
108 std::forward<Bound>(bound),
"less than",
"<") {}
113 requires internal::OrderedConstraintValue<T>
117 template <
class Bound>
118 requires std::constructible_from<T, Bound &&>
121 std::forward<Bound>(bound),
"less than or equal to",
"<=") {}
126 requires internal::OrderedConstraintValue<T>
130 template <
class Bound>
131 requires std::constructible_from<T, Bound &&>
134 std::forward<Bound>(bound),
"greater than",
">") {}
139 requires internal::OrderedConstraintValue<T>
143 template <
class Bound>
144 requires std::constructible_from<T, Bound &&>
147 std::forward<Bound>(bound),
"greater than or equal to",
">=") {}
Accepts values strictly greater than an owned lower bound.
GreaterThanConstraint(Bound &&bound)
Accepts values greater than or equal to an owned lower bound.
GreaterThanOrEqualConstraint(Bound &&bound)
Accepts values strictly less than an owned upper bound.
LessThanConstraint(Bound &&bound)
Accepts values less than or equal to an owned upper bound.
LessThanOrEqualConstraint(Bound &&bound)
Adapts an owned function or const function object to Constraint<T>.
ComparisonConstraintBase(Bound &&bound, const std::string &relation, const std::string &symbol)
bool operator()(const T &value) const
std::string shortID() const
ComparisonRule(Bound &&bound, const std::string &relation, const std::string &symbol)
std::string description() const