What am i doing wrong

Posted by Erik Sapir on Stack Overflow See other posts from Stack Overflow or by Erik Sapir
Published on 2010-03-14T09:23:52Z Indexed on 2010/03/14 9:25 UTC
Read the original article Hit count: 347

Filed under:
|

I have the following code. I need B class to have a min priority queue of AToTime objects. AToTime have operator>, and yet i receive error telling me than there is no operator> matching the operands...

#include <queue>
#include <functional>

using namespace std; 

class B{
//public functions
public:

    B();

    virtual ~B();

//private members
private:

    log4cxx::LoggerPtr      m_logger;

    class AToTime 
    {
    //public functions
    public:
        AToTime(const ACE_Time_Value& time, const APtr a) : m_time(time), m_a(a){}

        bool operator >(const AToTime& other)
        {
            return m_time > other.m_time;
        }

    //public members - no point using any private members here
    public:
        ACE_Time_Value      m_time;
        APtr                m_a;
    };


    priority_queue<AToTime, vector<AToTime>, greater<AToTime> > m_myMinHeap;
};

© Stack Overflow or respective owner

Related posts about c++

Related posts about operator-overloading