Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-14 00:17:28


AMDG

Julie Larson wrote:
> Hello,
>
> I'm using boost 1.35.0 and found this sample code about the hash set
> functionality:
>
> http://www.boost.org/doc/libs/1_35_0/doc/html/intrusive/advanced_lookups_insertions.html
>
> and modified it as shown below. I find that when iterating through
> the hash table, the thing crashes here (where the get_next function
> contains an invalid value for n):
>
> <snip>
> ~CWordHash()
> {
> BOOST_FOREACH( CWord& w, m_hWords )
> {
> CWord* pWord = &w;
> delete pWord;
>

I think this delete invalidates the iterator maintained by BOOST_FOREACH.

In Christ,
Steven Watanabe


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