How to extract the AA type?

Steven Schveighoffer schveiguy at yahoo.com
Thu Dec 14 13:39:50 UTC 2017


On 12/13/17 3:23 PM, Steven Schveighoffer wrote:
> On 12/13/17 11:30 AM, jmh530 wrote:
>> How about:
>>
>> template RealAAType!(T, V, K)
>> {
>>      import std.traits : CopyConstness;
>>
>>      alias RealAAType = CopyConstness!(T, V[K]);
>> }
> 
> Yes, that seems to work, I was worried that something like this would 
> give me multiple type modifiers (.e.g const(const(int)[int])
> 
> Now, I need to figure out how to do this in object.d :)
> 
> BTW, the PR that spurred this for reference: 
> https://github.com/dlang/druntime/pull/1992

After thinking about it, I've decided to simply use the workaround I 
implemented, just apply const to the AA in all cases, since I have to 
cast to void * anyway.

Thanks for the tips, I learned a little bit here :)

-Steve


More information about the Digitalmars-d mailing list