On 10/21/2015 11:13 AM, Timon Gehr wrote:
On 10/21/2015 05:08 PM, Timon Gehr wrote:
There would be no mutable aliasing.
Here, I mean within the data structure itself. There is nothing wrong with:
class Cell{ int x=0; }
FunSet!Cell a;
a.insert(new Cell());
auto b=a;
foreach(c;a) c.x=1;
assert(b.x==1);
This is analogous to:
struct SingletonFunSet(T){
T element;
}
auto a=SingletonFunSet!Cell(new Cell());
auto b=a;
a.element.x=1;
assert(b.x==1);
Here, SingletonFunSet!Cell is a value type, but it's constituents might
not be.
It seems to me that's a departure from traditional persistent data
structures. Those have immutable elements; far as I can tell you discuss
containers that only have immutable topology. -- Andrei