Project

General

Profile

Bug #2109

Updated by Junxiao Shi over 9 years ago

Snippet to reproduce: 

 ``` 
 #include <ndn-cxx/common.hpp> 
 #include <ndn-cxx/security/validator-config.hpp> 

 using namespace ndn; 

 void 
 f(int i) 
 { 
 } 

 int 
 main() 
 { 
   bind(&f, _1); 
   return 0; 
 } 
 ``` 

 Expected: the program compiles   
 Actual: `error: reference to ‘_1’ is ambiguous` 

 --- 

 `boost/bind/placeholders.hpp` puts `_1` in unnamed namespace and imports it to the global namespace.   
 However, this placeholder is incompatible with `std::bind`.   
 

 Applications are forced to write `using std::placeholders::_1` if they are not in `namespace ndn`. 

 There are two potential workarounds: 

 * `#define BOOST_BIND_NO_PLACEHOLDERS` <http://stackoverflow.com/a/13597226/3729203> 
 * specialize `std::is_placeholder` <https://svn.boost.org/trac/boost/ticket/2240#comment:10> 

 One This Task is to adopt one of these workarounds should be adopted. workarounds.

Back