Boost logo

Boost :

From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2000-08-30 14:05:24


Hi,
Beman Dawes wrote:

> Name pollution is a serious problem with non-member functions.

Note, that the non-member functions can be located in appropriate namespaces:
They are detected via argument dependent lookup (aka Koenig Lookup). Thus,
although non-member function names are used, there is actually no big
potential
for name collisions (well, assuming reasonable compilers, that is). There is,
of
course, a pollution problem with non-member functions in the global namespace,

though. For the flexibility necessary when using generic programming, there
are
actually two choices:

- non-member functions are used without explicit qualifaction, relying on
    argument dependent lookup.

- explicitly qualified non-member functions are used, ie. they are refined in
a
    special namespace.

I think the first approach is the right one: There is only a name collision
problem
if the same entity is to be used as argument for two different purposes using
the
same name. The alternative is to require that the generic glue is implemented
in
a specific namespace.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk