Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54958 - trunk/libs/serialization/src
From: ramey_at_[hidden]
Date: 2009-07-15 02:42:44


Author: ramey
Date: 2009-07-15 02:42:43 EDT (Wed, 15 Jul 2009)
New Revision: 54958
URL: http://svn.boost.org/trac/boost/changeset/54958

Log:
Fixing error - pure virtual function call
Text files modified:
   trunk/libs/serialization/src/basic_serializer_map.cpp | 22 +++++++++++++++++-----
   1 files changed, 17 insertions(+), 5 deletions(-)

Modified: trunk/libs/serialization/src/basic_serializer_map.cpp
==============================================================================
--- trunk/libs/serialization/src/basic_serializer_map.cpp (original)
+++ trunk/libs/serialization/src/basic_serializer_map.cpp 2009-07-15 02:42:43 EDT (Wed, 15 Jul 2009)
@@ -39,11 +39,23 @@
 
 BOOST_ARCHIVE_DECL(void)
 basic_serializer_map::erase(basic_serializer * bs){
- map_type::iterator it;
- it = m_map.find(bs);
- assert(it != m_map.end());
- if(*it == bs)
- m_map.erase(it);
+ map_type::iterator it = m_map.begin();
+ map_type::iterator it_end = m_map.end();
+
+ while(it != it_end){
+ // note item 9 from Effective STL !!! it++
+ if(*it == bs)
+ m_map.erase(it++);
+ else
+ it++;
+ }
+ // note: we can't do this since some of the eti records
+ // we're pointing to might be expired and the comparison
+ // won't work. Leave this as a reminder not to "optimize" this.
+ //it = m_map.find(bs);
+ //assert(it != m_map.end());
+ //if(*it == bs)
+ // m_map.erase(it);
 }
 
 BOOST_ARCHIVE_DECL(const basic_serializer *)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk