Boost logo

Boost Users :

From: Pablo Aguilar (pablo.aguilar_at_[hidden])
Date: 2005-04-20 16:21:40


"Mathieu De Zutter" <mathieu_at_[hidden]> wrote in message
news:20050420153314.GA3272_at_pleyel.kotnet.org...
> Hi,
>
> I have some code that runs fine:
>
> for (Partition::iterator pi = renderRegions.begin(); pi !=
> renderRegions.end(); ++pi);
> (*pi)->render(&ltt, foo, si);
>
> I try to replace it by for_each & boost::bind,
>
> std::for_each(renderRegions.begin(), renderRegions.end(),
> boost::bind(&Region::render, _1, &ltt, foo, si));
>
> but si doesn't get modified, while it should be passed as reference.

Try using:
std::for_each(renderRegions.begin(), renderRegions.end(),
    boost::bind(&Region::render, _1, &ltt, foo, boost::ref(si)));

> --
> With kind regards,
> Mathieu

Pablo Aguilar


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