Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -4,21 +4,21 @@ struct Item {
string name;
real amount, value;
@property real valuePerKG() @safe const pure nothrow {
@property real valuePerKG() @safe const pure nothrow @nogc {
return value / amount;
}
string toString() const /*pure nothrow*/ {
string toString() const pure /*nothrow*/ @safe {
return format("%10s %7.2f %7.2f %7.2f",
name, amount, value, valuePerKG);
}
}
real sumBy(string field)(in Item[] items) @safe pure nothrow {
real sumBy(string field)(in Item[] items) @safe pure nothrow @nogc {
return reduce!("a + b." ~ field)(0.0L, items);
}
void main() {
void main() /*@safe*/ {
const items = [Item("beef", 3.8, 36.0),
Item("pork", 5.4, 43.0),
Item("ham", 3.6, 90.0),