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>();
}