Boost logo

Boost Users :

Subject: [Boost-users] using bind with operator new
From: Archie14 (admin_at_[hidden])
Date: 2009-05-19 17:42:22

I am trying to use bind to generate ptr_vector list of objects from another

#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>

class a

class b
        b(a* val) : _val(val)
        boost::shared_ptr<a> _val;

void test()
        boost::ptr_vector<a> lsta;
        boost::ptr_vector<b> lstb;

        typedef boost::ptr_vector<b> listofb;

        // create lstb by applying new to each element of lsta and pushing it
to lstb. Fails. I will appreciate any help with this.
        std::for_each (lsta.begin(), lsta.end,
                boost::bind((&listofb::push_back), lstb,
                        boost::bind((&operator new), b, _1)

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at