3 ms·
std::vector<std::string> v = getList(); std::for_each(v.begin(), v.end(), boost::mem_fn(&std::string::sort)); Hadn't used it in, well, forever, but have done s
by ismarc 16y ago
std::vector<std::string> v = getList();
std::for_each(v.begin(), v.end(), boost::mem_fn(&std::string::sort));
Hadn't used it in, well, forever, but have done something similar. Pretty much stolen straight off of http://live.boost.org/doc/libs/1_34_1/libs/bind/mem_fn.html http://live.boost.org/doc/libs/1_34_1/libs/bind/mem_fn.html . For non-boost solution:
http://www.cplusplus.com/reference/std/functional/mem_fun/ http://www.cplusplus.com/reference/std/functional/mem_fun/