How do you peek a variant containing a complex value?
Vinay Sajip
vinay_sajip at yahoo.co.uk
Sat Feb 22 18:00:16 UTC 2020
The following program won't compile if I uncomment the if
statement:
void main()
{
Variant v = complex(1.0, 1.0);
// if (v.peek!(Complex)) {
// writeln("Complex");
// }
writeln(v);
}
I get the same error with v.peek!(complex), which is:
Error: template instance peek!(Complex) does not match template
declaration peek(T)()
The variant can clearly hold a complex value. Someone please tell
me - what am I doing wrong in the peek call?
More information about the Digitalmars-d-learn
mailing list