Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2020-08-03 14:04:19


On 2020-08-03 16:01, 逸霖 杨 via Boost wrote:
> 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()).

1. Calling dispose method when the rcgc_shared_ptr is destroyed is still
wrong. By definition, there are supposed to be multiple pointers to a
shared object, and destroying a single shared pointer must not result in
"cleaning up" the shared object.

2. What is the purpose of the special syntax of the dispose function?
What is its semantics outside the rcgc_shared_ptr? Why do you need this
special syntax and not a regular method that is used by rcgc_shared_ptr?
These are the sort of questions you will be asked by the committee when
you bring this proposal. In fact, I think you'll me asked these even
before you bring the proposal before the committee. There needs to be a
very strong reason to introduce a new syntax.


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