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 Peter Dimov, 14 years ago

Status: newassigned

comment:2 by Peter Dimov, 14 years ago

Milestone: Boost 1.37.0To Be Determined

comment:3 by brwarner@…, 12 years ago

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 by Peter Dimov, 12 years ago

Status: assignednew

comment:5 by brwarner@…, 12 years ago

What is the current status with this issue?

comment:6 by tliang, 11 years ago

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

comment:7 by Kohei Takahashi <flast@…>, 10 years ago

Cc: flast@… added

+1

comment:8 by Nana Sakisaka <n.sakisaka@…>, 10 years ago

Cc: n.sakisaka@… added

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

comment:9 by Nana Sakisaka <n.sakisaka@…>, 10 years ago

Version: Boost 1.36.0Boost Development Trunk

comment:10 by anonymous, 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 bret.kuhns, 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.

Note: See TracTickets for help on using tickets.