我在linux上用的是GCC 4.1.2,STL必须是SGI STL。 在我写完之后:
#include <functional>
std::find_if(PirateFlush, PirateFlush + size,
compose2(std::logical_and<bool>(), bind2nd(std::greater<UInt32>(), time),
bind2nd(std::less<UInt32>(), now)));
编译器说:
错误:“compose2”未在此范围内声明
怎么了?
最佳答案
compose2
不是标准的,既不在全局命名空间也不在 std
命名空间中。
gcc 在 __gnu_cxx
命名空间中提供了一些非标准的 SGI 扩展。
使用 __gnu_cxx::compose2
,或者 boost 有许多预定义的。
-尼克
关于c++ - 为什么我不能使用函数适配器 compose2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12190069/