Code review comment for lp:~pete-woods/unity-api/add-glib-assigner-class

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> The only thing really bothering me now is the dual implementations of shared
> and unique assigners. If you could conditionally compile different stuff into
> the deleter depending of if the template argument was a uptr or sptr then you
> could collapse this down. You'd also be able to collapse the two assign_sptr
> and assign_uptr methods at the same time.

Function overloading?

    ~GObjectPtrAssigner()
    {
        if (_ptr)
        {
           do_stuff(_smart, _ptr);
        }
    }

    void do_stuff(std::shared_ptr<TypeName>& _smart, element* _ptr)
    {
       _smart.reset(_ptr, GlibDeleter<typename S::element_type>());
    }

    void do_stuff(std::unique_ptr<TypeName>& _smart, element* _ptr)
    {
        _smart.reset(_ptr, GObjectDeleter());
    }

review: Approve

« Back to merge proposal