Boost logo

Boost Users :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2006-06-14 14:14:52


On Jun 14, 2006, at 12:41 PM, me22 wrote:

> On 6/14/06, Steven E. Harris <seh_at_[hidden]> wrote:
>> me22 <me22.ca_at_[hidden]> writes:
>>> Presumably if noncopyable were defined in namespace boost, then
>>> function calls involving classes deriving from noncopyable would get
>>> namespace boost added to the ADL scopes in which the function is
>>> looked up.
>>>
>> Even if the derivation is private, as it should be for such an
>> implementation detail?
>>
> I'd hope not, but I don't actually know.

Yes, the namespace of private base classes are searched during ADL.
Imho, private inheritance for implementation is more fragile than
other means for this reason. That being said, as long as no
functions ever get put into boost::noncopyable_, then no harm should
be done.

One also has to watch out for ADL in the namespaces of template
arguments (another common accidental use of ADL). For example:

std::vector<N::MyClass, M::MyAllocator> v;

foo(v); // searches std, N, M

-Howard


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net