problem w/std::sort_heap

Hey all,

I'm trying to use std::sort_heap to sort an STL vector. The vector uses a custom data type, so I created a comparison function object that goes like this:

1
2
3
4
5
6
7
struct evtcmp
{
   bool operator()(const Event &e1, const Event &e2)
   {
      return (e1.getExecTime()>e2.getExecTime());
   }
};


Then later, sort_heap is called as part of a method, like so:

1
2
3
4
5
6
7
8
void EventManager::addEvent(event_type e_type,TimeBlock& t, void* obj)
{
   heap.push_back(Event(e_type,t,obj));
   std::push_heap(heap.begin(),heap.end());
   std::sort_heap(mvEventHeap.begin(),mvEventHeap.end(),evtcmp);
   /*necessary; sort_heap destroys heap properties of a range.*/
   std::make_heap(heap.begin(),heap.end());
}


When I go to compile this, I get an error that says, on the sort_heap line, that it "expected primary-expression before ')' token." What exactly am I calling improperly here? Thanks much in advance.
You need to instantiate the struct.

evtcmp()

Topic archived. No new replies allowed.