Boost logo

Boost :

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

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
for name collisions (well, assuming reasonable compilers, that is). There is,
course, a pollution problem with non-member functions in the global namespace,

though. For the flexibility necessary when using generic programming, there
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
    special namespace.

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

Do You Yahoo!?
Get your free address at

Boost list run by bdawes at, gregod at, cpdaniel at, john at