On 4/3/15 4:53 AM, Steven Schveighoffer wrote:
On 4/2/15 8:21 PM, Andrei Alexandrescu wrote:
Hey folks, is there any way to figure out whether a type is immutable or
shared given its typeinfo? I see there's only the flags() method that
doesn't tell that. I'm thinking we'd do good to extend that.
This is needed for allocators. I'm thinking an allocator might be
interested at creation time to use different allocation strategies for
qualified types, especially shared ones.
I use this technique in lifetime.d:
// typeof(ti) is TypeInfo
auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
https://github.com/D-Programming-Language/druntime/blob/master/src/rt/lifetime.d#L640
Thanks Adam and Steve. Guess I should have asked this in the learn forum
:o). -- Andrei