Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 1999-08-18 07:12:59

At 04:18 PM 8/17/99 -0500, Ed Brey wrote:

>I can see it being convenient to pull all the integer types into the
>current namespace in one operation. To that end, I'd like to
>that cstdint.hpp change to look like this:
>namespace boost
>namespace integer_types
>#include <boost/stdint.h>
>using namespace integer_types;
>} // namespace boost
>This would allow a particular function to do something like this:
>void fn()
> using namespace boost::integer_types;
> int_least8_t var1;
> uint32 var2;
> ...
>In general, I think this kind of sectioning would be useful for
>groups of related names that show up in "utility" libraries like

I like it! Particularly if it will stop the namespace police from
complaining about my uses of "using namespace whatever;" :-)

Someone, Valentin I think, previously suggested boost sub-namespaces,
and I reacted negatively. What is different this time? Well, your
proposal is clearly written and demonstrates a practical user
benefit, and that always helps.

But technically, it is the addition of "using namespace
integer_types;" bringing the sub-namespace names into namespace boost
which sways me. This gives the users great freedom of choice.
Including the choice of ignoring the sub-namespace completely; the
follow still work:

   using namespace boost;
   int_least8_t myvar;

   using boost::int_least8_t;
   int_least8_t myvar;

   boost::int_least8_t myvar;

That means that we could go back and introduce sub-namespaces to all
of boost per your proposal without breaking existing code. Always a

How would such sub-namespace names and the level of granularity be
chosen? A possible default is to use the header name (without
extension). That makes it easy to remember the sub-namespace names,
and usually yields appropriate granularity. Some of the header names
may be a bit awkward, as in namespace cstdint, but on the whole they
aren't bad.

What do others think? Ed's proposal makes most sense if applied to
all boost libraries, so we need a strong consensus before proceeding.


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