MAX/MINを実装

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

No files matched your search

+21 -3
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()
{