transporting qualifier from parameter to the return value

Kagamin spam at here.lot
Wed Dec 16 06:22:20 PST 2009


Denis Koroskin Wrote:

> > 	void doSomething(inout(Object)[] a, inout(Object)[] b) {
> > 		a[0] = b[0]; // works only when objects in both arrays have the same  
> > constness.
> > 	}
> >
> >
> 
> Doesn't work.
> 
> doSomething("hello", "world");

Yes, one more level of indirection is needed:

void doSomething(inout(T)[][] a, inout(T)[][] b){ a[0]=b[0]; }

though it's subject to the const bug when you pass T[][] and immutable(T)[][] which is due to the current const system.



More information about the Digitalmars-d mailing list