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.
void performoperator(List<string> list, string operator, int &OpCount)
^^^^^^^^
operator
is a reserved keyword in C++; you cannot use it as a variable name.
只是一个猜测:您将模板代码放在cpp文件中而不是在头文件中
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.