Files
cppdraft_translate/cppdraft/depr/relops.md
2025-10-25 03:02:53 +03:00

3.1 KiB

[depr.relops]

Annex D (normative) Compatibility features [depr]

D.14 Relational operators [depr.relops]

1

#

The header has the following additions:

namespace std::rel_ops {template bool operator!=(const T&, const T&); template bool operator> (const T&, const T&); template bool operator<=(const T&, const T&); template bool operator>=(const T&, const T&);}

2

#

To avoid redundant definitions of operator!= out of operator== and operators >, <=, and >= out of operator<, the library provides the following:

🔗

template<class T> bool operator!=(const T& x, const T& y);

3

#

Preconditions: T meets the Cpp17EqualityComparable requirements (Table 28).

4

#

Returns: !(x == y).

🔗

template<class T> bool operator>(const T& x, const T& y);

5

#

Preconditions: T meets the Cpp17LessThanComparable requirements (Table 29).

6

#

Returns: y < x.

🔗

template<class T> bool operator<=(const T& x, const T& y);

7

#

Preconditions: T meets the Cpp17LessThanComparable requirements (Table 29).

8

#

Returns: !(y < x).

🔗

template<class T> bool operator>=(const T& x, const T& y);

9

#

Preconditions: T meets the Cpp17LessThanComparable requirements (Table 29).

10

#

Returns: !(x < y).