Hello : Try using boost::ref to avoid creating a copy of the arguments (see http://www.boost.org/doc/html/ref.html ) : std::for_each( rr.begin(), rr.end(), boost::bind( boost::mem_fn( &Region::render ), _1, boost::ref( ltt ), foo, boost::ref( si ) ) ); Good luck! On 4/20/05, Mathieu De Zutter <mathieu@dezutter.org> wrote:
Hi,
I have some code that runs fine:
for (Partition::iterator pi = renderRegions.begin(); pi != renderRegions.end(); ++pi); (*pi)->render(<t, foo, si);
I try to replace it by for_each & boost::bind,
std::for_each(renderRegions.begin(), renderRegions.end(), boost::bind(&Region::render, _1, <t, foo, si));
but si doesn't get modified, while it should be passed as reference.
Some more relevant code:
class Region { ... void render(const LightTransportType* ltt, WorkAppraiser& wa, image::SampleImage& result); ... };
typedef std::vector< Region* > Partition; Partition renderRegions;
Is this normal behaviour?
-- With kind regards, Mathieu _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users