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


On 09/14/2015 12:07 AM, Daniel wrote:
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)

Sounds reasonable if the result of GetByTab is only ever used immediately afterwards to make calls on the returned XclImpAutoFilterData, and not stored away for future use (which indeed appears to be the case here).

Two more random comments:

*  I think it is better to avoid trivial typedefs like

typedef std::shared_ptr<XclImpAutoFilterData> XclImpAutoFilterSharePtr;

and instead spell it out where used (and rather try to keep the number of places where to spell it out low with "auto"). Makes it immediately obvious to the reader that this is indeed just a std::shared_ptr and not some elaborate, home-grown class with semantics subtly different from std::shared_ptr.

*  I think it isn't even necessary here to go with shared_ptr, a

  std;;vector<std:;unique_ptr<XclImpAutoFilterData>> maFilters;

should already do (given the above decision to keep returning a raw ptr from GetByTab). (It looks like even a direct

  std::vector<XclImpAutoFilterData> maFilters;

would do, if it were not for the missing <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4371.html> "Minimal incomplete type support for standard containers, revision 2.")

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.