[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



Martin v. Loewis wrote:
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.

Actually Daniel Elstner (gtkmm) person gave me the tip to use find_if and forget about operator overloading. I still think this unnecessary complexity for looking for a pair by it's first member, but perhaps I should have chosen map in the beginning ;-)

Thanks for your clarifications
   Christof Petig


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



Reply to: