Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-11-22 15:01:12


----- Mensaje original -----
De: Sean Perry <perry_at_[hidden]>
Fecha: Jueves, Noviembre 22, 2007 8:28 pm
Asunto: Re: [boost] [config][vacpp8.0]
BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL should be
defined?
Para: boost_at_[hidden]

> This code does have the name hiding.overload resolution issues
> still.

I don't see how name hiding is involved here:

    ...
    void swap(foo& x){swap_(x);}
    void swap_(foo& x)
    {
      using std::swap;
      swap(t,x.t);
    }
    ...

Note that swap(t,x.t) is called inside swap_, with "_" suffix.

> Can you change the call to swap so you use "std::swap(t.x, t.y)"
> instead of the using declaration and "swap(t.x,t.y)".

This wouldd avoid using ADL, which is what the problem's all
about.

> The following compiles for me:
>
> #include <algorithm>
>
> template<typename T>
> struct foo
> {
> T t;
> foo():t(0){}
> void swap(foo& x){swap(x);}
> void swap(foo& x)
[...]

Maybe you've pasted your code wrong, cause the above
redeclares foo::swap().

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