Reference or Value Semantics for Graph Traversal Range
"Nordlöw" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Feb 18 05:59:42 PST 2015
On Wednesday, 18 February 2015 at 13:53:17 UTC, Tobias Pankrath
wrote:
>> All the data members except distMap have reference semantics.
>
> I thought AAs had reference semantics.
Me too, but the indeed have value semantics. See for example:
unittest
{
string[int] x;
auto y = x;
x[0] = "zero";
assert(x != y);
}
This makes usage of storing internal state in Ranges bug-prone.
Isn't there some way to store an AA in reference wrapper?
This would simplify my .save member.
More information about the Digitalmars-d-learn
mailing list