Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 1999-12-18 14:03:02

Ed Brey wrote:
> Furthermore, we should discourage "using namespace boost"
> in the first place, since it can unforeseen conflicts as names are added to
> boost.

Hey, good. Somebody finally came out and said it: using-directives in
general are just plain dangerous and unpredictable. Let's not make any
decisions which are based on a desire to accomodate them.

Now, here's a question worth answering: would it work to add to
namespace boost explicit using-declarations of all names in boost::cast?
I tried it with gcc and it worked, but of course GCC lets you get away
with relying on the using-directive, which doesn't work. (I'm booted
into Linux right now, so I'm away from my other compiler). It looks like
Comeau also lets the using-directive work. Metrowerks is one compiler I
know of that handles this right.



namespace foo {
    template<class X, class Y>
      X foo_cast(Y y) { return X(y); }
  using namespace foo;
  namespace bar {
    template <class X, class Y>
      X bar_cast(Y y) { return X(y); }
  using bar::bar_cast;

namespace mine
  void f()
      long x = boost::bar_cast<long>(1); // should work(?)
      long y = boost::foo_cast<long>(2); // should fail!

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