Opened 10 years ago

Last modified 5 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@…


Change History (11)

comment:1 Changed 10 years ago by Peter Dimov

Status: newassigned

comment:2 Changed 10 years ago by Peter Dimov

Milestone: Boost 1.37.0To Be Determined

comment:3 Changed 9 years ago by brwarner@…

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.

comment:4 Changed 8 years ago by Peter Dimov

Status: assignednew

comment:5 Changed 8 years ago by brwarner@…

What is the current status with this issue?

comment:6 Changed 7 years ago by tliang

#including <boost/bind/placeholders.hpp> breaks code that uses the new std::placeholders.

comment:7 Changed 6 years ago by Kohei Takahashi <flast@…>

Cc: flast@… added


comment:8 Changed 6 years ago by Nana Sakisaka <n.sakisaka@…>

Cc: n.sakisaka@… added

+1, I think that it is highly important to fit the new spec of C++11.

comment:9 Changed 6 years ago by Nana Sakisaka <n.sakisaka@…>

Version: Boost 1.36.0Boost Development Trunk

comment:10 Changed 6 years ago by anonymous

+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 Changed 5 years ago by bret.kuhns

+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.

Note: See TracTickets for help on using tickets.