February 04, 2014 Enhancement 7191 - ctor opAssign - usecase | ||||
---|---|---|---|---|
| ||||
Hi, this is regarding http://forum.dlang.org/thread/bug-7191-3@http.d.puremagic.com%2Fissues%2F I work with structures to fill and retrieve data from a database. For database column type decimal I created a template structure Decimal. While using Decimal in other structures I noticed that although opAssign(string) is available for my template structure, I cannot use it in ctor. This would be really nice syntax suggar. Is there any news regarding this? Kind regards André struct Decimal(int precision, int scale){ void opAssign(string s){ // ... } } struct OrderDb{ string orderId; Decimal!(10,2) amount; } void main(){ OrderDb order = OrderDb("1","125.44"); // <- cannot implicitly convert expression order.amount = "125.44"; // <- works } |
Copyright © 1999-2021 by the D Language Foundation