Boost logo

Boost Users :

Subject: Re: [Boost-users] BOOST_FOREACH infinite loop issue
From: Neil Groves (neil_at_[hidden])
Date: 2010-06-11 15:01:42


On Fri, Jun 11, 2010 at 4:17 PM, yabcok <yabcok_at_[hidden]> wrote:

> I'm afraid you are wrong. Subsequent handle values would be 0, 1,
> INVALID_ELEMENT_HANDLE.
>

Yes, you are correct. The sequence is always 0, 1, INVALID_ELEMENT_HANDLE.

> Please, compare this program behavior in release and debug builds, to
> see the real problem (infinite lopp at the last BOOST_FOREACH).
>
>
I have looked into this problem, and have tracked it down to an interaction
between code optimization and the use of std::pair with BOOST_FOREACH. The
problem can be worked around by replacing std::pair<Iterator, Iterator> with
boost::iterator_range<Iterator> which to my mind is a neater solution
anyhow. Hopefully this information will be of some use to you, and I shall
continue to investigate the problem with std::pair.

> Regards,
> Jacek
>
>
Sorry for my earlier mistake.

Regards,
Neil Groves



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