View mode: basic / threaded / horizontal-split · Log in · Help
March 14, 2012
AA reference semantics
Is this a bug?

	int[string] aa, bb;
	bb = aa;
	aa["abc"] = 123;
	assert(bb["abc"] == 123);	// assertion fails

The following works:

	int[string] aa, bb;
	aa["def"] = 456;
	bb = aa;
	aa["abc"] = 123;
	assert(bb["abc"] == 123);	// OK


T

-- 
Don't drink and derive. Alcohol and algebra don't mix.
March 14, 2012
Re: AA reference semantics
"H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote in message 
news:mailman.652.1331699976.4860.digitalmars-d@puremagic.com...
> Is this a bug?
>

Nope.


> int[string] aa, bb;
aa == bb == null

> bb = aa;
same

> aa["abc"] = 123;
A new AA is created.


> assert(bb["abc"] == 123); // assertion fails
>

B is still null
Top | Discussion index | About this forum | D home