
David Abrahams wrote:
Peter, I've been expecting for some time that you were going to put the placeholders in a sub-namespace of boost, if only to avoid the ODR violations it is currently causing. No?
Correct me if I'm wrong, but the ODR violations are caused by the use of an unnamed namespace; this is not related to whether the placeholders are in a subnamespace of boost. It seems to me that Lambda's placeholders should be susceptible to the same sort of ODR violations. (I know that I asked you for an ODR/_1 example once and you provided it, but I don't remember what it was and can't find it at the moment. Sorry.)
The fact that I have to write mpl::_1 just to avoid colliding with <unnamed>::_1 is disconcerting at best. If another library came along and did what boost/bind/placeholders.hpp does, it would cause a clash.
First mover advantage, you know. (Kidding.)
My suggestion, assuming you care about backwards compatibility, is:
boost/bind/placeholders.hpp
declares placeholders in namespace boost::bind::placeholders.
But does not _define_ them? (I had boost::placeholders in mind for a namespace, consistent with std::tr1::placeholders; when you use 'boost' as a substitute for 'std::tr1', boost::bind::placeholders won't work.)
boost/bind/bind.hpp
has the current contents of boost/bind.hpp, except that placeholders are not declared in the <unnamed>::
boost/bind.hpp
#include <boost/bind/bind.hpp> #include <boost/bind/placeholders.hpp> namespace { using namespace boost::bind::placeholders; }
Hm. What is the difference between this directive and the simple using namespace boost::bind::placeholders; ? I can't think of any. This, of course, will still require you to use mpl::_1. I assume that you intend to fix all your includes to belong to... err, point to the using-directive-less version?