Note that there are some explanatory texts on larger screens.

plurals
  1. POA very weak reference (cannot be turned into shared)
    primarykey
    data
    text
    <p>I'd like to know if there is any smart pointer type concept that implements the "very weak reference" idea.</p> <p>This would be basically a <code>weak_ptr</code> but that cannot be turned into a <code>shared_ptr</code>, basically, when you have <code>very_weak_refs</code> out-there, you are sure that the strong-ref count can never go up.</p> <p>This would allow better "strong ownership" of memory by managers, and delivering very weak references in the wild would still allow clients to access the data by using good old raw pointer through a <code>.lock_get()</code> function or equivalent... (name designed to mirror what you would have doing <code>.lock().get()</code> usually).</p> <p>You don't have the same security on data, because your object may be destroyed while you use it, but if your environment is controlled enough so that you know that the manager's cannot clean its data while you are processing, you're still good to use raw-pointers locally after having checked against <code>null_ptr</code> after <code>lock_get()</code>.</p> <p>Do any of you wished for similar thing, more info/intelligence/thoughts on that ? thanks.</p> <p>rationale : the motivation behind is that <code>weak_ptr</code> has the "security flaw" of being turnable to shared and therefore, after distributing weak references in the wild, you basically did the same than distributing shared ones because anybody can keep very long lived shared refs on your data effectively preventing correct cleaning by the entities that were suppsed to be strong (the manager).</p> <p>This is solved by very-weak-refs, when you distribute that kind of objects in your manager's public interface, you are sure that when you delete your last shared ref, your data is deleted.</p> <p>For me, the whole concept of weak references works only with well behaved clients; who understands that they should promotes their weak refs into shareds for only small amounts of time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload