Introduce WTF::Unique
Created attachment 280974 [details] Patch
Created attachment 280975 [details] Patch
Created attachment 280983 [details] Patch
I like the idea of this class, but I’m not sure I’m comfortable with the name Unique.
Maybe UniqueRef by analogy with unique_ptr.
Created attachment 280990 [details] Patch
Created attachment 280994 [details] Patch
Created attachment 280997 [details] Patch
Created attachment 280999 [details] Patch
Comment on attachment 280999 [details] Patch I see the point: you have to use something like std::unique_ptr here, and having a type to indicate it can never be null seems useful. I just wonder if the actual benefit would be worth the cost of having one more type of Ref to learn and understand. Probably; converting pointer member variables to refs elsewhere in the code has had big readability benefits. Shame there's no standard solution for this. Agreed with Darin that the name is not good, a "unique ref" sounds like something that shouldn't be refcounted. It's hard to name though... "NonintrusiveRef" is not great, but it's the best I can think of. "NonnullUniquePtr" is awkward but clear. Alternatively we could try to think of a name that indicates its purpose for holding values of polymorphic type.
http://trac.webkit.org/changeset/201941