Martin v. Loewis wrote:
Christof Petig <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Reply via email to