Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2007-11-19 03:15:30


"K. Noel Belcourt" ha escrito:

> On Nov 16, 2007, at 5:10 AM, Joaquín Mª López Muñoz wrote:
>
> > John Maddock ha escrito:
> [...]

> >> In foo::swap the local declaration of the member function "swap"
> >> hides any occurances of swap in the outer scope, and the using declaration
> >> behaves "as if" std::swap were imported into the *enclosing namespace*, which
> >> would still be hidden... and yet I can't believe that this simple idiom
> >> isn't actually legal ! :-) And indeed all the other compilers I tested
> >> do compile this OK.
> >
> > Ouch, didn't think about name hiding... this is why I love C++ :-/
> >
> > Now I don't know either whether the code is legal or not. Anyway,
> > if I changed foo::swap to foo::swop the code would be undoubtedly legal then,
> > right?
> >
> > Noel, would you please try the attached variation?
>
> Compiles fine with vacpp-8.0, no errors or warnings.

Ok, thanks for your help! I think I'll change then my code to avoid the name hiding
thing, hopefully you'll see multi_index tests go green for vacpp-8.0 in the next
cycle.

As for whether the original test (with name hiding) is legal or not, well, I don't
really know, but I'd love to have the opinion of some C++ guru.

Thank you,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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