[WIP] Remove boost dependency in sc/source/filter/excel/excimp8.cxx
Daniel
danlrobertson89 at gmail.com
Sun Sep 13 15:07:11 PDT 2015
Albert,
Thanks for the patch!
> It would be great if I could get some advice on how to move forward on
> removing more of the boost dependency.
I'm definitely not the most experienced person here, but I can try to
give you some pointers.
> for( const auto& rFilterPtr : maFilters )
> rFilterPtr->Apply();
Awesome! Much more readable.
> Should i modify it to return XclImpAutoFilterSharePtr instead?
I personally wouldn't. I would use std::shared_ptr::get()
(http://en.cppreference.com/w/cpp/memory/shared_ptr/get)
One more random comment. In general std::make_shared
(http://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared)
is better than constructing using std::shared_ptr<T>::shared_ptr(T*)
and then copying. That will result in two heap allocs vs. make_shared
which should just perform one. The following stack-overflow question
sums up the pros and cons of make_shared quite nicely.
(http://stackoverflow.com/questions/20895648/difference-in-make-shared-and-normal-shared-ptr-in-c)
Again, I still have a lot to learn, so take everything I say with a
grain of salt, but I think you're definitely on the right track. I
attached a patch combining what you had and the above random points.
Best,
Daniel
On Sun, Sep 13, 2015 at 10:06:05AM +0200, Albert Thuswaldner wrote:
> Hi,
> It would be great if I could get some advice on how to move forward on
> removing more of the boost dependency.
>
> Originally I was working on this:
> [bug 93243] replace boost::bind with C++11 lambdas
>
> Line 18: sc/source/filter/excel/excimp8.cxx
> std::for_each(maFilters.begin(),maFilters.end(),
> boost::bind(&XclImpAutoFilterData::Apply,_1));
>
> Searching the code I hav found examples where this type of for_each
> loop is replaced by a simple for loop:
>
> for( const auto& rFilterPtr : maFilters )
> rFilterPtr->Apply();
>
> This requires some additional modificatioins to the code which can be
> seen in the attached patch.
>
> The question which is left is what to do with what the function below
> should return:
>
> XclImpAutoFilterData* XclImpAutoFilterBuffer::GetByTab( SCTAB nTab )
>
> Should i modify it to return XclImpAutoFilterSharePtr instead?
> Am I on the right track in general?
>
> Thanks for the help!
>
> /Albert
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tdf-93243-replace-boost-bind-with-C-11-lambdas.patch
Type: text/x-diff
Size: 2805 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150913/2854da92/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150913/2854da92/attachment.sig>
More information about the LibreOffice
mailing list