Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 错误:预期模板名称早于<;代币_C++_Templates - Fatal编程技术网

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