How to extract the AA type?
jmh530
john.michael.hall at gmail.com
Wed Dec 13 16:30:16 UTC 2017
On Wednesday, 13 December 2017 at 16:00:32 UTC, Steven
Schveighoffer wrote:
> A nice puzzle for those template gurus out there.
>
> I have a function like this:
>
> auto foo(T: V[K], V, K)(T t)
> {
> RealAAType!(T, V, K) aa = t;
> return aa;
> }
>
> So I need to know what to write RealAAType. What I'm looking
> for is a mechanism to write the exact AA type that is passed
> in. RealAAType should be an AA, and nothing else.
>
[snip]
How about:
template RealAAType!(T, V, K)
{
import std.traits : CopyConstness;
alias RealAAType = CopyConstness!(T, V[K]);
}
More information about the Digitalmars-d
mailing list