class Event{
public:
enum EventType { A_1, A_2, A_3, A_4};
Event(EvtType type = A_1, double etime = 0.0)
: _type(type)
, _etime(etime)
{}
EventType get_Type() const { return _type; };
double get_Time() const { return _etime; }
protected:
EventType _type;
double _etime;
};
struct EventLess{
bool operator()(const Event& lhs, const Event& rhs) const
{
return (lhs.get_Time() > rhs.get_Time());
}
};
Run Code Online (Sandbox Code Playgroud)
我可以创建最小优先级队列,如下所示
priority_queue<Event, std::vector<Event>, EventLess> q;
Run Code Online (Sandbox Code Playgroud)
但是,如果我有另一个类,如:
class Event1
{
public:
enum EventType { disruption_1, disruption_2};
Event(EvtType type = disruption_1, double …Run Code Online (Sandbox Code Playgroud)