Topic: Using functions in std::rel_ops namespace
Author: phalpern@truffle.ma.ultranet.com (Pablo Halpern)
Date: 1998/02/09 Raw View
CD-2 states that the functions in namespace std::rel_ops are there to
avoid redundant definitions of operations like != that can be
constructed from other operations (==).
I don't understand how this feature can be used. For example, if I do
the following:
using namespace std::rel_ops;
Then any class that defines == and < will work with !=, <=, etc. This
might not be appropriate. On the other hand, I would like to be able to
define a class as follows:
class X { ... };
bool operator==(X, X);
bool operator<(X, X);
Then I'd like to somehow use std::rel_ops to automatically make !=, <=,
>= and > available for class X. Is there anyway to do this?
-------------------------------------------------------------
Pablo Halpern phalpern@truffle.ultranet.com
I am self-employed. Therefore, my opinions *do* represent
those of my employer.
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]