InstanceOf Template during runtime in a variant

Andre andre at s-e-a-p.de
Mon Feb 3 10:15:56 PST 2014


Hi,

I want to check whether the value stored in
variant v is a type of Decimal during runtime.
Is there a nice way?

Kind regards
André

import std.variant;

struct Decimal(int scale, int precision){
	int _precision = precision;
	int _scale = scale;

	this(string value){/*...*/}
}

void main(){
	Variant v = Decimal!(10,2)("123.00");
}


More information about the Digitalmars-d-learn mailing list