In c++ the "!=" operator when used with container from std does not compare address like the "==" in java ( at times), it only compares
the values. The standard C++ library was implemented with generic in
mind.
Well, if that is the case, those operators would have had to have been overloaded for those operations, otherwise the comparitors would compare addresses. I would have to go and look at the library code, (I use DevC++) to check and see if that's the case. I'm pretty sure that for any object regardless if it's in a collection or not will have to have the comparitors overloded in addition to providing a deep copy constructor. Come to think of it, if you call something to the effect of:
someCollection<someClass> someObject[] = new someCollection<someClass>()[2];
someObject[0] = someData;
someObject[1] = otherData;
if (someObject[0] != someObject[1])
{
std::cout << "AHHHHHH!!!! Run for your lives!!! ";
}
that operator will be called from the overloaded operator defined in someClass, not someCollection. What I was saying, without knowing if someObject overloads !=, you have no guarantee that you are comparing someData and otherData. If not you will be comparing the dereferenced addresses of each object. So in java, this is one of the reasons that all classes derive from Object. That way, they can implement the equals() method to ensure that you are comparing by value and not by reference.
Also, c++ calls generic types template types. But you knew that.
So . . . should this thread be moved to c++ or did LKH get his answer? Sorry for the rambling.