我无法对自定义类指针列表进行排序。我需要排序的类是事件。这些被分配一个随机时间,我需要以正确的顺序执行它们。
#include <list>
Class Event{
public:
float time; // the value which I need to sort them by
int type; // to indicate which event i'm dealing with
Event(float tempTime, int tempType)
{
time = tempTime;
type = tempType;
}
int main(){
std::list<Event*> EventList;
list<Event*>::iterator it;
.........
如果您能帮我解决这个问题,将不胜感激!我已经坚持了几个小时了。
谢谢!