On 12/28/2014 05:08 PM, julien2412 wrote:
Hello,
I noticed this part:
889 void ScDBCollection::DeleteOnTab( SCTAB nTab )
890 {
...
908 remove_if(maAnonDBs.begin(), maAnonDBs.end(), func);
909 }
"remove_if" is useless since there's no erase.
I thought about adding an "erase" by taking example of this
http://en.wikipedia.org/wiki/Erase-remove_idiom
but AnonDBs doesn't have an ad hoc erase method (like NamedDBs, but this one
has a "simple" erase method), see
http://opengrok.libreoffice.org/xref/core/sc/inc/dbdata.hxx#152
Should we remove this line? Should we add an ad hoc "erase" method to
implement erase-remove idiom in NamedDBs + AnonDBs?
Any thoughts?
Presumably the call to erase is inadvertently missing ever since that
call to remove_if got introduced in
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=1b059829bc6698c15c6bb5459a61348ac56ffda5>
"Added container to store global anonymous db ranges."
AnonDBs (sc/inc/dbdata.hxx) looks like it is a thin wrapper around a
boost::ptr_vector, exporting just those member functions of the
underlying ptr_vector class that are used by client code, plus some
AnonDBs-specific functions, which arguably is not the most
maintenance-friendly approach.
So looks like AnonDBs should also export the underlying ptr_vector's
ranged erase.
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice