|
Boost Users : |
From: Julie Larson (julie.larson_at_[hidden])
Date: 2008-05-14 00:20:55
Thanks for the quick response Steven, However I think if you look at
it you'll see that the destructor hasn't been called yet when the
crash happens. The error happens during the iteration in main when
trying to print out the contents of the word class. The destructor
for the CWordHash class won't be called until after that when main
exits.
On Tue, May 13, 2008 at 9:17 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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