Re: using std::rel_ops by Igor
Igor
Wed Apr 12 17:27:43 CDT 2006
Angel Tsankov <fn42551@fmi.uni-sofia.bg> wrote:
> How do I use the canonical definition of != out of == in std::rel_ops?
>
> #include <utility>
>
> namespace n {
> class c { };
>
> bool operator ==( c const&, c const& )
> {
> return true;
> }
>
> using namespace std::rel_ops;
Make it
using std::rel_ops::operator!=;
A using declaration (that's what I show) introduces a new name as a
synonym for the entity named in the declaration. This name can then be
referred to from other scopes.
A using directive (that's what you have in your code) does not introduce
any new names, but simply aids name lookup within the scope in which it
appears. It has no effect outside of said scope.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925