Boost logo

Boost Users :

From: Mark Snelling (mark_at_[hidden])
Date: 2002-10-29 11:43:51


Hello,
I was wondering if anyone out there in Boost land could give me a hand
here? Here's the problem:

I have a class A:

class A
{
public:
        A(int i) : _priority(i) {}
        int priority() {return _priority;}

private:
        int _priority;
};

What I want to do is create a std::priority_queue based on
boost::shared_ptr<A> and use boost::bind/compose to create the sorting
function required by std::priority_queue. However, when I try and
typedef the queue (to save a lot of typing) I get compiler errors on
VS.NET.

using namespace std;
using namespace boost;

typedef priority_queue<shared_ptr<Functor>,
                vector<shared_ptr<Functor> >,
                bind(less<int(),
                        bind(&Functor::priority, _1),
                        bind(&Functor::priority, _2))> MyQueue;

Am I going about this the right way? Any help appreciated.
TIA

Mark.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net