Boost logo

Boost Users :

From: Rodolfo Lima (rodolfo_at_[hidden])
Date: 2003-09-08 07:00:08


What's the proper way to use lambda with smart pointers? I'm trying to
compile the following:

class Dados
{
public:
    Dados(int _a) : a(_a) {};
    int Pega() const { return a; }

private:
    int a;
};

int main()
{
    shared_ptr<Dados> pDados(new Dados(5));
    cout << (bind(&Dados::Pega, _1)(pDados)==5) << endl;
    return 0;
}

I've already tried with *_1 with no success. In this case, the compiler
(VC7.1) returns "error C2039: 'iterator_category' : is not a member of
'boost::shared_ptr<T>'".

Any hope?

Thanks,
rod


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