Boost logo

Boost Users :

Subject: Re: [Boost-users] Nested BOOST_FOREACH crash
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-02-22 01:16:56


On 19/02/2016 11:53, peyman_at_[hidden] wrote:
> I am experiencing sporadic crashes that look like memory problem when
> I have nested (2 level) BOOST_FOREACH loops.
>
> Reason I say it looks like memory problem is because slightest
> change will make it crash or not crash. For example, adding a simple
> cout would change it!
>
> I cannot provide a testcase. So I am just wondering if anybody has
> experienced the same, or know what could be going on.
>
> I am using Boost 1.57.

Without seeing a test case it's hard to say what issue you're running
into, but the most common problem when using BOOST_FOREACH is doing
something that modifies the collection being enumerated. This may be
indirect, as a side effect of some method being called inside the
BOOST_FOREACH, so it may not be immediately apparent. It could also be
action on another thread.


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