
Sergey Sadovnikov <flex_ferrum <at> artberg.ru> writes:
Perfectly! What you can say about following pieces of code:
std::vector<std::shared_ptr<SomeClass>> vec; std::for_each(vec.begin(), vec.end(),
std::bind(&std::shared_ptr<SomeClass>::get, std::placeholders::_1, std::bind(&SomeClass::foo, std::placeholders::_1, 10)));
and
vector<shared_ptr<SomeClass>> vec; for_each(vec.begin(), vec.end(), bind(&shared_ptr<SomeClass>::get, _1,
bind(&SomeClass::foo, _1, 10)));
What about scoped using directive (or using declaration)? { // begin code using namespaces using namespace std; using namespace std::placeholders; vector<shared_ptr<SomeClass>> vec; for_each(vec.begin(), vec.end(), bind(&shared_ptr<SomeClass>::get, _1, bind(&SomeClass::foo, _1, 10))); } // end code using namespaces Explicit, readable, and doesn't affect code outside the braces