On 27/06/2015 02:48, Marvin Humphrey wrote:
I can't think of anything better than a hash table lookup.  We can probably
reuse LockFreeRegistry for this purpose.

A simple array should be good enough for most use cases. I think it's rare that a class implements more than three of four interfaces. We could also use a specialized hash table with pointer keys. We only insert during initialization, so there's no need to support resizing or deletion.

This only works if we made the host objects "clone on incref" like stack
Strings.

Is there any reason not to?  The use case seems even more apt than strings.

We'd only need a way to tell whether a host object was allocated on the stack. It would be nice if we had a generic solution for that (using a bit of the refcount field, for example).

Nick

Reply via email to