www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Enhancement 7191 - ctor opAssign - usecase


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

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 
	order.amount = "125.44"; // <- works

Feb 04 2014