Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-08-13 06:53:43


Beman Dawes <bdawes_at_[hidden]> writes:

> Current GCC and Intel compilers don't appear to allow using
> declarations at function scope, according to a bug report.
>
> Is there any reason not to just move the using declarations to
> namespace scope?
>
> Answering my own queston, I think prefer the solution used in other
> boost code where calls to say std::abs are explicitly qualified, and
> ifdef BOOST_NO_STDC_NAMESPACE then namespace std { using ::abs; } is
> supplied.

One possibility is to transform:

  namespace B
  {
    X f(Y y)
    {
        using A::g;
        return g(y);
    };
  }

into:

  namespace B
  {
    namespace Bf
    {
      using A::g;

      X f(Y y)
      {
          return g(y);
      };
    }
    using Bf::f;
  }

Ugly, but effective?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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