gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 00:17:55 25 4
gpt4 key购买 nike

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com