Defined in the standard header utility, and in the nonstandard backward-compatibility header function.h.
The requirement for
The requirement for
The requirement for
The requirement for
The precondition for
The precondition for
template <class T>
void relations(T x, T y) {
if (x == y) assert(!(x != y));
else assert(x != y);
if (x < y) {
assert(x <= y);
assert(y > x);
assert(y >= x);
} else if (y < x) {
assert(y <= x);
assert(x < y);
assert(x <= y);
} else {
assert(x <= y);
assert(x >= y);
}
}
Equality Comparable, LessThan Comparable
Classes
pair<T1, T2>
Category: utilities
Component type: type
Functions that need to return two values often return a
pair<bool, double> result = do_a_calculation();
if (result.first) do_something_more(result.second);
else report_error();
Defined in the standard header utility, and in the nonstandard backward-compatibility header pair.h.
Parameter | Description |
---|---|
T1 | The type of the first element stored in the |
T2 | The type of the second element stored in the |
Assignable
None.
Member | Where defined | Description |
---|