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


So,

        Julien had some good ideas for simplifying VclPtr usage; here is the
background - currently we have:

        VclPtr<Foo> pFoo;
                + empty VclPtr pointer eg. shared_ptr<Foo> xFoo;

        VclPtrInstance<Foo> pFoo( pParent );
                + creates a pFoo as above, and initializes it to an
                  instance; we can't expose 'new Foo()' publicly due
                  to the odd reference counting behavior. ::Create
                  is a little like make_shared
                + sementically this is:
                  VclPtr<Foo> pFoo = VclPtr<Foo>::Create( pParent );

        * Suggestion - lets kill VclPtrInstance in a world with
          'auto' its main use of saving a bit of typing is gone
          ie.

                auto pFoo = VclPtr<Foo>::Create( pParent );


        ScopedVclPtr<Foo> pFoo;
                + empty VclPtr that is disposed when it goes out of
                  scope.
                + I guess something like unique_ptr - but with a
                  safe ref-count to the underlying object which can
                  survive (in a disposed state) for longer than the
                  scope.
                + something of a confusing name

        * Suggestion: rename it to VclPtrAutoDispose - longer but
          perhaps clearer (?) - or something else ?

        ScopedVclPtrInstance<Foo> pFoo( pParent );

        * Suggestion: as above - re-use auto and an:

                auto pFoo = VclPtrAutoDispose<Foo>::Create( pParent );

        Thoughts pro & con appreciated before doing the cleanup =) are there
better / more familiar name and approaches ?

        Hopefully using 'auto' would at least kill half of the template
complexity there =)

        ATB,

                Michael.

-- 
michael.meeks@collabora.com <><, Pseudo Engineer, itinerant idiot

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.