Hello,

I have a class called "Set<T>" (a template class) and a function outside of it. One of the parameters of the function is "const Set<T> &setCompare2".
Inside the function, I need to call one of the (public)member functions of the class called "IsMember" (from the setCompare2 variable).

The problem is that when I compile the program, I get this error:

"error C2662: 'IsMember' : cannot convert 'this' pointer from 'const class Set<int>' to 'class Set<int> &'"

Currently, I have 3 solutions to this problem that may work, but every solution has its flaw:

1. Changing the function parameter from "const Set<T> &setCompare2" to "Set<T> &setCompare2". I can't do that because of the instructions of writing this program (it's an exercise).

2. Copying the lines of the IsMember function to the problematic function: not efficient.

3. Declaring a "Set<T>" local variable in the problematic function, copying all the setCompare2's attributes values into it and using it to call the IsMember function:
requires a lot of time from the processor (many copy instructions).

Does anyone have another idea?

Thanks.