|
Boost : |
From: Joseph Gauterin (joseph.gauterin_at_[hidden])
Date: 2007-08-16 11:25:45
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk