std.typecons Typedef initializers?

Chris Katko ckatko at gmail.com
Mon Apr 25 08:54:52 UTC 2022


````D
struct pair
{
float x,y;
}

alias sPair = Typedef!pair; // pair of xy in screen space 
coordinates
alias vPair = Typedef!pair; // pair of xy in viewport space 
coordinates
//etc

void test()
{
pair v0 = pair(1f, 2f); // works fine, but what about the 
typedefs?

vPair v1 = vPair(1f, 2f); //nope

vPair v2 = Typedef!vPair(1f, 2f); //nope
}

````

How do you initialize a typedef'd struct?


More information about the Digitalmars-d-learn mailing list