I'm writing a function that detaches the data from a container and returns the number of elements detached:
int detach(foo f)
{
try {
/*some code*/
return m_ids.size();
} finally {
m_ids.clear();
}
}
foo
is an object that receives the data in m_ids
, which is a java.util.List
.
My concern: is this code safe? Will it return the size of m_ids
before it's cleared?