C++ 错误:预期模板名称早于<;代币
你好,我得到以下错误C++ 错误:预期模板名称早于<;代币,c++,templates,C++,Templates,你好,我得到以下错误 templateatt.cpp:4:32: error: expected template-name before ‘<‘ token templateatt.cpp:4:32: error: expected â{â before ‘<‘ token templateatt.cpp:4:32: error: expected unqualified-id before ‘<‘ token templateatt.cpp:4:32:错误:在“之前预期模
templateatt.cpp:4:32: error: expected template-name before ‘<‘ token
templateatt.cpp:4:32: error: expected â{â before ‘<‘ token
templateatt.cpp:4:32: error: expected unqualified-id before ‘<‘ token
templateatt.cpp:4:32:错误:在“之前预期模板名称不要忘记\include
获取一元函数
,然后用std::一元函数
对其进行限定不要忘记\include
获取一元函数
,然后用std::一元函数
对其进行限定编译器和我,我们都看不到一元函数的任何定义
…编译器和我,我们都看不到一元函数的任何定义
。@user1663533好!我知道你还不能接受,但别忘了接受你能接受的。谢谢。:)@用户1663533很好!我知道你还不能接受,但别忘了接受你能接受的。谢谢。:)
#include<iostream>
template <class R, class T>
class mem_fun_t: unary_function<T*, R> {
R (T::*pmf)();
public:
explicit mem_fun_t(R (T::*p)()):pmf(p){}
R operator() (T *p) const { return (p->*pmf()); }
};
int main() {
return 0;
}