我在尝试使用for_each迭代遍历指向向量的指针时遇到了奇怪的错误。
我想要对这些指针中的每一个调用一个方法。
objects_
的类型为vector<someClass*>
for_each(objects_.begin(), objects_.end(), std::bind1st(std::mem_fun(&someClass::someMethod), this));
但是这段代码甚至都无法编译,因为:
error C2039: 'bind1st' : is not a member of 'std'
error C2039: 'mem_fun' : is not a member of 'std'
error C3861: 'bind1st': identifier not found
error C3861: 'mem_fun': identifier not found
然而其他STL算法和方法都能正常工作。
我是不是漏掉了什么?
<functional>
库吗? - Piotr Skotnicki