On Fri, Jun 11, 2010 at 4:17 PM, yabcok <yabcok@gmail.com> 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