[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: G++-3.x bug? user specified operator== not found/used by find



Christof Petig <christof@petig-baender.de> writes:

> Perhaps the namepace of the first argument determines the namespace
> searched for the operator ?

All arguments determine the namespaces search for functions. This is
called Koenig lookup (after Andrew Koenig, inventor of this
mechanism), or argument-dependent lookup. It applies uniformly to all
unqualified function calls, whether operator or not.

As a result, you should not overload operators based only on types
from std. Instead, any operator you overload should involve one of
your own types as well. It is an error to extend namespace std in an
application.

Regards,
Martin


-- 
To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: