Reputation: 95
Hello I am getting the following error
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
When I compile the following cpp file:
#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;
}
Any help will be great. I Am stuck at this.
Upvotes: 1
Views: 8296
Reputation: 110658
Don't forget to #include <functional>
to get unary_function
and then qualify it with std::unary_function
.
Upvotes: 7