1
0

MAX/MINを実装

This commit is contained in:
otya128
2016-09-03 16:07:30 +09:00
parent cc85f76b81
commit 361a8e04c1
3 changed files with 77 additions and 3 deletions

View File

@@ -136,15 +136,33 @@ struct Value
}
int castInteger()
{
return this.type == ValueType.Integer ? this.integerValue : (this.type == ValueType.Double ? cast(int)this.doubleValue : 0);
if (this.type == ValueType.Integer)
{
return this.integerValue;
}
if (this.type == ValueType.Double)
{
return cast(int)this.doubleValue;
}
throw new TypeMismatch();
}
double castDouble()
{
return this.type == ValueType.Integer ? this.integerValue : (this.type == ValueType.Double ? this.doubleValue : 0);
if (this.type == ValueType.Integer)
{
return this.integerValue;
}
if (this.type == ValueType.Double)
{
return this.doubleValue;
}
throw new TypeMismatch();
}
wstring castString()
{
return this.type == ValueType.String ? this.stringValue : "";
if (this.type == ValueType.String)
return this.stringValue;
throw new TypeMismatch();
}
string toString()
{