Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-02-24 17:31:22

At 06:40 PM 2/23/2002, rameysb wrote:

>I am currently putting the finishing touches on a library I hope to
>submit to
>I studying the other boost libraries it seems that all the library
>user callable funcations are added to the namepace boost while
>private functions are added to namespace boost::detail
>How does one know that the names he chooses don't collide with any
>others used in the library? Must one check the whole library? If
>one wants to use a common name such as "save" are subsquent library
>builders bared from using it on penalty of creating a collision?
>Suppose I am creating a library for object serialization
>called "serialize" Would it not be convenient to use
>namespace serialize for public interfaces and
>namespace serialize::detail for private ones.
>users would then do one of the following:
> boost::serialize::save(....
>using namespace boost::serialize;
> save(...
>Am I missing something obvious here? Has this question come up
>before and be resolved to the current system - if so what is
>the rational.

As Boost gets larger, we are becoming more sensitive to the problem. Thus
the I/O state library just accepted puts names in a sub-namespace (like
your serialize example) under boost.

My rule-of-thumb has been to use a sub-namespace if (1) your library has a
lot of names and/or (2) the names are likely to clash with other libraries.
Some others feel a library should almost always go in a sub-namespace.


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