I'm trying to know which one is the bigger value at any type, for that propouse I have done a template, and I'm using a member function to resolve which one is the bigger, but I dont pass any argument I'm trying to resolve that with this...I dont If it can de done or not...here is my code I hope somebody can help me...
the copmiler gives to me an error in the resolve function about how I'm treating operator this...and at any call of resolve function It can not resolve because overload...
From your snippet in the link above, you are doing this->a.length(). This will work only if a is a string but that is not always the case as the class is a template class and can take any type.
Have you considered what happens if your class takes other custom types? Something like
1 2 3 4
class X
{};
myclass<X> myObject;
To solve you issue with strings, you can check if the type passed to the class is a string and then doing the corresponding action.
I'm using type_info to resolve what you suggested before, but now I'm having a trouble because the compiler says:: request for member 'length' in '((myclass<int>*)this)->myclass<int>::b', which is of non-class type 'int'