On Aug 23, 2025, at 11:00 AM, organicoman <organicoman@yahoo.fr> wrote:
unique_ptr and shared_ptr have two distinct paradigms .1-unique_ptr moves the ownership totally, and to get back ownership , the callee need to return a unique_ptr{unique_ptr p=...;//assuming callee1 returns a unique_ptrp = move(callee1(move(p)));}BUT!!!, By the time callee1 returns, we don't know if the original resource or different resource is returned.
2-shared_ptr models sharing ownership, but only the counter decides when to free the resource.
With the proposal + 'passing by reference' guideline, we are modeling a paradigm, of allocate in one location, free from anywhere and all are notified.
But definitely, if it can be done by a compiler flag then it does the job.