Opened 14 years ago
Last modified 9 years ago
#2240 new Tasks
Move placeholders into the boost::placeholders namespace
Reported by: | Peter Dimov | Owned by: | Peter Dimov |
---|---|---|---|
Milestone: | To Be Determined | Component: | bind |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: | flast@…, n.sakisaka@… |
Description
Change History (11)
comment:1 by , 14 years ago
Status: | new → assigned |
---|
comment:2 by , 14 years ago
Milestone: | Boost 1.37.0 → To Be Determined |
---|
comment:3 by , 12 years ago
comment:4 by , 12 years ago
Status: | assigned → new |
---|
comment:6 by , 11 years ago
#including <boost/bind/placeholders.hpp> breaks code that uses the new std::placeholders.
comment:8 by , 10 years ago
Cc: | added |
---|
+1, I think that it is highly important to fit the new spec of C++11.
comment:9 by , 10 years ago
Version: | Boost 1.36.0 → Boost Development Trunk |
---|
comment:10 by , 10 years ago
+1 They are actually worse than global, they are in an unnamed namespace, so even bringing the std::placeholders to the local workspace doesn't work. The only sensible workaround is to overload std::is_placeholder so that it works with boost placeholders, then use boost::placeholders everywhere. Do you think we could have this overload in boost itself? The following works great:
namespace std { template<int n> struct is_placeholder<boost::arg<n>> : public integral_constant<int,n> {}; template<int n> struct is_placeholder<const boost::arg<n>> : public integral_constant<int,n> {}; /*namespace std*/ }
comment:11 by , 9 years ago
+1 this is very frustrating and requires a lot of disambiguation for something that should have always been in its own namespace to avoid these problems. Even better, argument-dependent lookup causes the boost placeholders in the inlined namespace to pull boost::bind as resolution candidate even though using namespace boost;
never appears in my project (I do use the std
namespace, however).
This is nasty, and confusing.
I agree with this response, when using TR1 you can not use "using namespace std::placeholders" since it conflicts with the boost placeholders which are global.