here is my code
Code: Select all
//yes..I know this is probably somewhere in the STL, but anyway...
class RobotList{
unsigned int length;
RobotObject *first,*last;
public:
unsigned int GetLen(){return length;}
RobotList(Robot *first);
void AddToList(Robot *to_add);
void RemoveFromList(Robot *pointer); //this only looks for the first pointer that matches..
void RemoveFromList(unsigned int index); //this could actually be easily accomplished by using operator []
RobotObject * const GetFromList(unsigned int index);
//RobotObject *const FindRobot(Robot *robot);
unsigned int const FindRobot(Robot *robot);
//the icing on the cake that makes things simple
Robot *operator [] (unsigned int index);
//RobotObject *operator[](unsigned int index);
bool operator==(const Robot &cmp1,const Robot& cmp2){return 1;}
};
Robot *t=new....
RobotList *robots=new...
if(t==robots[0])
I always thought that it would the compiler would synthesize an == ! plus I thought this would just be comparing pointers! like not the actual object...