[swift-evolution] [Pitch] Set of AnyObject by reference

张国晔 cc941201 at me.com
Sun Jul 17 04:55:14 CDT 2016


> 在 2016年7月17日,17:44,Tino Heth <2th at gmx.de> 写道:
> 
> 
>> What I hope to achieve is to have a Set of unique objects by their references. For example, I might put in two rectangles with the same height and width (which makes them equal, but they are still different instances). 
> I guess this is not the best place for such problems, but did you already look at ObjectIdentifier?
> 
> Tino
> 


The problem is the motivation for my proposal of adding ReferenceSet<Element: AnyObject> and ReferenceDictionary<Key: AnyObject, Value> to stdlib.

The original object cannot be retrieved from ObjectIdentifier, which makes it unsuitable for my use-case.

- Guoye Zhang


More information about the swift-evolution mailing list