mercredi 18 avril 2018

Priority Queue with lambda function error

This is all in one class. Class B holds a list.

class A{
   bool compare = [](const B& lhs, const B& rhs){
     return lhs.list.size() >= rhs.list.size();
   };

   priority_queue<B, vector<B>, decltype(compare)> pq(compare);
};

I get any error on pq. I'm very unfamiliar with the lambda function so I have no clue how to solve this function.

ERROR: compare is not a type

Aucun commentaire:

Enregistrer un commentaire