user2179293
user2179293

Reputation: 435

Error: Expected ‘)’ before ‘&’ token

In the following code the compiler is showing error in second line while if I am not using a template class and explicitly defining V then it works fine.

template <class T,template <class T> class V>
void struct inp<T, V >::input(ifstream& in, V<T> lst)

Upvotes: 0

Views: 1030

Answers (1)

Paul Evans
Paul Evans

Reputation: 27577

You can't have both void and struct in your template declaration. Are you talking about a templated function or a templated class? And you probable want a const ref to that ifstream and at least a non-const refernce to your templated class template parmater. You want either a class:

template <class T,template <class T> class V>
struct inp<T, V >::input(const ifstream& in, V<T>& lst)

or a function:

template <class T,template <class T> class V>
void inp<T, V >::input(const ifstream& in, V<T>& lst)

Upvotes: 2

Related Questions