Feb 3, 2013 at 3:59pm UTC
How do I compare two variables who do not have a predefined Type (i.e Templates).
If I just do a==b it only works for integers and not for strings. Is there any general method present for comparing templates.
Feb 3, 2013 at 4:36pm UTC
@ vlad: your code looks recursive to me.
Feb 3, 2013 at 6:41pm UTC
I'm using the code posted by vlad above as a class member function and it displays and error:
operator == must take exactly one input argument
Feb 3, 2013 at 6:47pm UTC
> I'm using the code posted by vlad above
The code posted by vlad above is for a free function.
Do not, repeat, do not even think of using it; it is broken for more than one reason.
If neither T1 nor T2 is a user defined type, it will result in a compile-time error.
If it does not result in a compile-time error, it will cause an infinite recursion at run-time; the operator== will never return.