
On 7/13/06, Christopher Eltschka <celtschk@web.de> wrote:
operator< and operator== of course can be defined anywhere the std::rel_ops operators will find them (e.g. they could be defined as class members instead).
Note that you really only have to define operator< as operator== could be written as template<class T, class U> bool operator==(const T &lhs, const U &rhs) { return !(lhs < rhs) && !(rhs < lhs); } and the user could still define operator== themselves for optimization purposes (then you should make sure to define operator!= in terms of operator==). Are you going to allow comparision of different types (like I showed above) or strictly comparision among objects of the same type?
Alternatively it could be extended to support other typical operator implementations not covered by the standard, e.g. defining operator@ in terms of operator@=.
Sounds good. Kevin Spinar