Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


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.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.