|
Boost Users : |
Subject: Re: [Boost-users] [Lambda] Handling Bind/Lambda name clashes.
From: Eric Niebler (eric_at_[hidden])
Date: 2011-04-07 00:03:45
On 4/7/2011 1:02 AM, Steven Watanabe wrote:
> AMDG
>
> On 04/06/2011 10:46 AM, Peter Dimov wrote:
>> Eric Niebler wrote:
>>
>>> I'm saying that boost::function should actually be defined in
>>> boost::function_adl_block and be imported into the boost namespace
>>> with a using declaration.
>>
>> This makes no sense to me. boost::bind is the unconstrained function
>> template found by ADL, not boost::function. You ought to be arguing that
>> boost::bind should be in an ADL-blocking namespace. Of course this will
>> break all code that relies on ADL to omit the boost:: qualification.
>>
>
> The problem is that it's much easier to put
> a class in an ADL blocking namespace, than to
> put a class in al ADL blocking namespace:
Huh?
> namespace bind_adl_block
> {
> template<class F>
> void bind(F f);
> }
> using bind_adl_block::bind; // bind can still be found by ADL
>
> The only way to do it is with a using
> directive:
>
> using namespace bin_adl_block;
>
> but this is fragile for other reasons.
Wow, it seems there's a lot I don't know. Isn't this allowed:
using bind_adl_block::bind;
And what is wrong with leaving bind in the boost namespace as I was
suggesting and define boost::function like this:
namespace boost {
namespace function_adl_block {
template<class Sig>
struct function {...};
}
using function_adl_block::function;
}
Now the "boost" namespace is no longer associated with boost::function,
and boost::bind won't be found by ADL. Unless I'm mistaken, and a quick
test with comeauonline suggests I'm not. But Steven and Peter are
usually right about this stuff, so I'll patiently wait to be corrected
and learn. :-)
-- Eric Niebler BoostPro Computing http://www.boostpro.com
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