
16 Aug
2007
16 Aug
'07
3:25 p.m.
It is my understanding that if the 'push_back' throws, then program flow will never reach the BOOST_SCOPE_EXIT block, so the internal scope exits object will never be created, so it won't erroneously remove an element. This code would exhibit the behaviour you describe: BOOST_SCOPE_EXIT( (commit)(m_persons) ) { if(!commit) m_persons.pop_back(); } BOOST_SCOPE_EXIT_END m_persons.push_back(person); but the original looks safe to me.