Enhancement 7191 - ctor opAssign - usecase
Andre
andre at s-e-a-p.de
Tue Feb 4 11:06:33 PST 2014
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
}
More information about the Digitalmars-d
mailing list