|
Boost : |
From: ÒÝÁØ Ñî (yyl_20050115_at_[hidden])
Date: 2020-08-03 13:01:36
Last post was sent directly to Rob, I forgot to cc list.bost.org.
Thinking of the multiple calling of the detors, which is suggested by Rob and other members, I came up with some ideas.
This IS about specification.
If class A has a dispose method like
class A
{
A(){}
~A(){}
//Dispose method:
!A(){}
};
Where !A() can be called multiple times and ~A() can be called only one time.
Everything rcgc_ptr delegates will be called its dispose in !A() and therefore multiple times
to just decrease the reference count and finally call ~A() when real delete happens.
And this can be done on the compiler level (!A() maybe not visible at all or just visible when you use like ~A()).
Saying this algorithm is a part of the C++ language itself, then C++ has no need to manually manage
pointers (at least the unwanted management).
Idea is inspired by all of you especially Andrey Janson and Rob.
Thank you all!
Best Regards,
Yilin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk