
Glen Fernandes wrote:
On Mon, May 25, 2015 at 4:12 AM, Peter Dimov wrote:
Glen Fernandes wrote:
#include <boost/bind/bind.hpp>
using boost::placeholders::_1;
I'm having a bit of trouble deciding between the above and
using namespace boost::placeholders;
The using declarations are closer to the current code and would be a better bet compatibility-wise, but the using directive seems more correct somehow.
With the former, ::boost::placeholders::detail (if it exists now, or will in the future) would not become ::detail, if that matters.
There'll be nothing in boost::placeholders except _1.._9. Not 100% sure about the future. The using directive allows you to declare your own _1 in the global namespace: #include <boost/bind.hpp> int _1; int main() { ::_1 = 5; } This works now. It's possible to make it work with the using declarations as well, if we put them into an unnamed namespace. But the idiomatic way to use the standard placeholders is "using namespace std::placeholders;", so I tend towards the same.