gpt4 book ai didi

c++ - 不能使用从 std::unary_function 继承的 typedef

转载 作者:太空狗 更新时间:2023-10-29 20:27:42 24 4
gpt4 key购买 nike

<分区>

prog.cpp:9:13: error: ‘result_type’ does not name a type
prog.cpp:9:13: note: (perhaps ‘typename std::unary_function<_Arg, _Result>::result_type’ was intended)

编译器: http://ideone.com/vttG8W

为什么我不能直接使用 result_type?

#include <functional>

using namespace std;

template <typename ARGUEMENT, typename RESULT>
class FunctorBase : public std::unary_function<ARGUEMENT, RESULT>
{
public:
virtual result_type operator () (argument_type) = 0;
FunctorBase() {}
virtual ~FunctorBase() {}
};

int main()
{
FunctorBase<int&, void>();
}

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