Re: [boost] Bug: bind() escapes from boost:: namespace whenplaceholders are used

David Abrahams wrote:
In an expression of the form f(x, y), f is (also) looked up in the ("associated") namespaces of x and y. Since _1 is usually of type boost::arg<1>, boost is an associated namespace for it and the function "bind" is found without an explicit boost:: qualification.
Depending on your point of view, this might be an argument for moving the placeholders into a nested namespace (with a using directive to bring them out, of course).
That would be consistent with TR1 that has them in the std::tr1::placeholder namespace. It may also be useful to merge the bind and lambda placeholders to avoid issues with using lambda with bind. - Reece _________________________________________________________________ Try Live.com: where your online world comes together - with news, sports, weather, and much more. http://www.live.com/getstarted

Reece Dunn wrote:
David Abrahams wrote:
In an expression of the form f(x, y), f is (also) looked up in the ("associated") namespaces of x and y. Since _1 is usually of type boost::arg<1>, boost is an associated namespace for it and the function "bind" is found without an explicit boost:: qualification.
Depending on your point of view, this might be an argument for moving the placeholders into a nested namespace (with a using directive to bring them out, of course).
That would be consistent with TR1 that has them in the std::tr1::placeholder namespace. It may also be useful to merge the bind and lambda placeholders to avoid issues with using lambda with bind.
It is the boost:: in boost::arg<1> that causes ADL to look into boost. It doesn't matter where the placeholders themselves are declared (in the unnamed namespace currently). One might make the case for boost::_bi::arg<1>, I suppose.
participants (2)
-
Peter Dimov
-
Reece Dunn