Unable to use priority queue in Eclipse C++

I'm using Eclipse for c++ to write code to implement D* Lite and had to use priority queue. I included the header file #include and tried using std::priority_queue<> but when I write this I get an error stating that the symbol priority_queue could not be resolved. I tried rebuilding the project but the result was the same. I would be grateful if someone could help me fix this.

auto compare = [] (Node &l, Node &r) -> bool { 
    if(l._key.first<r._key.first)
    return true;
    else
     {
        if ((l._key.first==r._key.first)&&(l._key.second<r._key.second))
          return true;
        else
          return false;
     } 
};

template<
    class T,
    class Container = std::vector<T>,
    class Compare = std::less<typename Container::value_type>
> class Queue : public std::priority_queue<T, Container, Compare>
{
public:
    typedef typename
        std::priority_queue<
        T,
        Container,
        Compare>::container_type::const_iterator const_iterator;

    const_iterator find(const T&val) const
    {
        auto first = this->c.cbegin();
        auto last = this->c.cend();
        while (first!=last) {
            if (*first==val) return first;
            ++first;
        }
        return last;
    }
};

Queue<Node,std::vector<Node>, decltype(compare) > U (compare);

This is my custom priority queue which is sorted based on the key values of Node. This queue also has a find function which returns the element if found else . I could not check if this code works as my Eclipse IDE does not recognize priority_queue as mentioned above. Can someone please review my code .

0 Comment

NO COMMENTS

LEAVE A REPLY

Captcha image