Reputation: 459
I'm working on performing some operations on a polymorphic doubly-linked list, and I seem to be having some issues with that.
I'm trying to pass a instance of the class to this function:
void performoperator(List<string> list, string operator, int &OpCount){
//...
}
and I'm trying to call it as such:
List<string> list;
//...
performoperator(list, temp, OpCount);
The compiler doesn't appear to accept the way in which I'm calling the function, and I'm fairly certain the issue is with the templated class somehow. What am I doing improperly?
Edit: Resolved, won't let me post as a solution as I'm a new user. The issue was the I needed to pass the list by reference.
Upvotes: 0
Views: 94
Reputation:
Just a guess: You put template code in cpp file not in your header file
Upvotes: 1
Reputation: 355039
void performoperator(List<string> list, string operator, int &OpCount)
^^^^^^^^
operator
is a reserved keyword in C++; you cannot use it as a variable name.
Upvotes: 3