![]() |
От: |
uzhas
|
|
Дата: | 18.05.10 16:04 | ||
Оценка: |
#include <vector>
class A
{
};
bool operator==(const A& a, const A& b)
{
return true;
}
int main()
{
std::vector<A> a, b;
return a == b;
}
То есть EqualityComparable требует лишь возможность записи20.1.1 Equality comparison
Table 28—EqualityComparable requirements
a == b convertible to bool == is an equivalence relation,
that is, it satisfies the
following properties:
— For all a, a == a.
— If a == b, then b == a.
— If a == b and b == c, then a == c.
Я неясно почему комо не схватил этого помощника20.2.1 Operators
1. 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);