class AURStateSwitch : public TObject { private: double t; int state; public: AURStateSwitch(double ctime = 0, int cstate = 0) : t(ctime), state(cstate) { } double Time(void) const { return t; } int State(void) const { return state; } Bool_t IsSortable() const { return kTRUE; } Int_t Compare(const TObject *obj) const { if (t > ((AURStateSwitch *)obj)->t) return 1; else if (t < ((AURStateSwitch *)obj)->t) return -1; else return 0; } Bool_t IsEqual(const TObject *obj) const { return (t == ((AURStateSwitch *)obj)->t && state == ((AURStateSwitch *)obj)->state); } }; void testlist(void) { TSortedList list; for (int i = 0; i < 10; i++) list.Add(new AURStateSwitch(i, 0)); TIter next(&list); AURStateSwitch *ss; while (ss = (AURStateSwitch *)next()) cout << ss->Time() << " " << ss->State() << endl; }