![]() |
Boost bind
Hi,all. I hanve a class T, and T has a member fuanction func(int a,
int b), In vector<shared_ptr<T>>, how can I use for_each, this does not compiled: for_each(v.begin(), v.end(), bind(&T::func, _1)(a, b)); |
Re: Boost bind
On 3月5日, 上午8时42分, STL-BOOST <wartal...@gmail.com> wrote:
> Hi,all. I hanve a class T, and T has a member fuanction func(int a, > int b), In vector<shared_ptr<T>>, how can I use > for_each, this does not compiled: > for_each(v.begin(), v.end(), bind(&T::func, _1)(a, b)); "boost::bind(x, y, z)" is to produce a functor. while your code "bind(&T::func, _1)(a, b)", the syntax means that you already invoke the functor, and return what "T::func" returns. so I think you should write "bind(&T::func, _1, a, b)" instead. HTH -- Best Regards Barry |
| All times are GMT. The time now is 11:47 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.