|
|
|
|
|
by alkonaut
2217 days ago
|
|
Thanks. That does feel a bit backwards, for the purpose of GF tracking as you can’t store id->obj. I assume if/when a WeakRef is exposed in the language then a normal map can be used to store id->WeakRef(obj), so no real need them for also having a “mapWithWeakRefValues”? |
|
One common use is to associate extra data with objects, without attaching it to those objects directly. In your map, you add an obj->extradata mapping. Having the target be a WeakRef would just mean you'd lose your extradata while the source obj is still around.