Boost logo

Boost :

From: ÒÝÁØ Ñî (yyl_20050115_at_[hidden])
Date: 2020-08-04 04:02:19


Accepting the kindly advices from dear members (Rob, Andrey, Seth and others),
I just updated the code with disposing version of rcgc_ptr (shared is removed to avoid misunderstandings)
New added class is called rcgc_d_ptr.

rcgc_ptr uses the dtor and would call the dtor multiple times of the reference object.

rcgc_d_ptr needs the class to have a function named disposing() where all rcgc_d_ptr wrapped fields
should call their .dispose() method (not ->dispose() method).


class D
{
public:
    D() :_ptr_outC(){}
    ~D() {
        std::cout << "dtor for object of D:" << std::hex << this << std::endl;
    }
public:
    void disposing() {
        //Should NOT be this->_ptr_outC->disposing()
        //which will lead to this function itself (direct/indirect-recursion).
        //NOTICE:Don't call self directly or indirectly!
        this->_ptr_outC.disposing();
    }
public:
    rcgc_d_ptr<C> _ptr_outC;
};


And here is the GitHub address again in case you don¡¯t get the last posts.
https://github.com/yyl-20020115/RCGC



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk