我在排序自定义类指针列表时遇到问题.我需要排序的类是事件.这些被分配一个随机时间,我需要按正确的顺序进行.
#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;
.........
Run Code Online (Sandbox Code Playgroud)
如果你能帮我解决这个问题,我将不胜感激!我已经被困在这几个小时了.
谢谢!