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.me...@collabora.com <><, Pseudo Engineer, itinerant idiot
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to