- **status**: accepted --> review
---
** [tickets:#2224] imm: Improve the iteration in ImmModel**
**Status:** review
**Milestone:** 5.2.FC
**Created:** Mon Dec 12, 2016 07:09 AM UTC by Hung Nguyen
**Last Updated:** Mon Dec 12, 2016 07:09 AM UTC
**Owner:** Hung Nguyen
After removing an element from a map, the iterator is reset to begin.
</br>
~~~
for(ci2=sAdmReqContinuationMap.begin();
ci2!=sAdmReqContinuationMap.end();) {
if(ci2->second.mConn == dead) {
TRACE_5("Discarding Adm Req continuation %llu", ci2->first);
sAdmReqContinuationMap.erase(ci2);
ci2=sAdmReqContinuationMap.begin();
} else { ++ci2;}
}
~~~
</br>
With C++11, erase(const_iterator) returns an iterator to the next element.
We can avoid resetting the iterator.
---
Sent from sourceforge.net because opensaf-tickets@lists.sourceforge.net is
subscribed to https://sourceforge.net/p/opensaf/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/opensaf/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-tickets mailing list
Opensaf-tickets@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets