mem_fun and bind1st problem

前端 未结 2 1375
小蘑菇
小蘑菇 2021-01-22 00:07

I\'ve following class:

class A {
public:
// ctr and etc ...
A*   clone(B* container);
};

Now, I\'ve a vector availableObjs

2条回答
  •  长发绾君心
    2021-01-22 00:37

    If you use Boost.Bind it might look like this:

    std::transform(
                   availableObjs.begin(), availableObjs.end(), 
                   back_inserter(clonedObjs),
                   boost::bind(boost::mem_fn(&A::clone), _1, container) ); 
    

提交回复
热议问题