I have two object containing the same numbers.
the first object has numbers coming as follow: n1 = 1.2.3.4.5.6.7.8.9.10
and the second object : n2 = 2.6.3.4.8.6.7.9.5.10.1
Is there anyway to compare the two object to see if they are similar or not??
Sometimes the answer is so simple that i really don't get how i missed it .
The only think i had to so is add:
list2.sort();
well. thank you for the help
I don't think your code is doing what you're expecting.
Line 30: You're calling operator == and passing list1 and list2. Both list1 and list2 are of type list<int>. That's going to call std::relational operator ==, not your function in testlist.cpp because the signatures are different. Your operator == (.cpp line 6) is expecting two arguments of type TestList&, not list<int>. http://www.cplusplus.com/reference/list/list/operators/
BTW, if you were to actually call your operator ==, it would result in infinite recursion and a program crash. How do you think line 9 is going to be evaluated? That will result in a recursive call to your operator==, which results in another call to it, ad nauseum.