c++ - 为什么我不能使用函数适配器 compose2?

标签 c++ stl sgi

我在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/

相关文章:

c++ - 如何将 std::transform 与模板一起使用

c++ - C++中运算符重载的返回值

c++ - 使用 FFmpeg 的音频均衡器

c++ - 尽管类型在析构函数中完全限定,但 std::auto_ptr 崩溃和泄漏

c++ - visual studio 找不到 std :map during linkage

c++ - 结合 boost::lexical_cast 和 std::transform

c++ - <STL_hashtable> 中是否不需要构造函数参数

c++ - 是选择模板函数的重载还是仿函数(函数对象)的部分特化

c++ - 模板类 <T> 中的 std::map 键为 <T>