How auto convert Variant to required function arguments?
Ferhat Kurtulmuş
aferust at gmail.com
Fri Oct 9 15:49:31 UTC 2020
On Friday, 9 October 2020 at 00:19:20 UTC, Marcone wrote:
> How auto convert Variant to required function arguments?
import std.variant;
import std.stdio;
Variant a;
int mul2(Variant b){
int c = *b.peek!(int);
return 2*c;
}
int mul3(int b){
return 3*b;
}
void main()
{
a = 5;
writeln(mul2(a));
Variant b = 3;
writeln(mul3(*b.peek!int));
}
More information about the Digitalmars-d-learn
mailing list