Boost logo

Boost :

Subject: Re: [boost] [bind] Placeholders suggestion, std and boost
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2015-05-24 22:03:36

On Sun, May 24, 2015 at 6:21 PM, Edward Diener <eldiener_at_[hidden]> wrote:
> I realize that changing boost::bind so by default that placeholders of the
> form _n needing some sort of namespace in front of it will break plenty of
> code, so I am not suggesting doing that. What I would like to suggest is a
> Boost.bind macro, which when used before including <boost/bind>, would put
> the boost::bind placeholders of the form _n in a boost::placeholders
> namespace.

I propose creating <boost/bind/bind.hpp>. Including it should result
in the placeholders being in boost::placeholders namespace.
<boost/bind.hpp> would now do nothing more than just include
<boost/bind/bind.hpp> and bring all the placeholders into the global

e.g. Contents of <boost/bind.hpp>
  #ifndef BOOST_BIND_HPP
  #define BOOST_BIND_HPP

  #include <boost/bind/bind.hpp>

  using boost::placeholders::_1;
  using boost::placeholders::_2;
  using boost::placeholders::_3;


Documentation can be updated to remove all mention of <boost/bind.hpp>
in favor of <boost/bind/bind.hpp> and now state that placeholders are
within boost::placeholders. (Existing code that includes
<boost/bind.hpp> would not be affected).


Boost list run by bdawes at, gregod at, cpdaniel at, john at