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.

Reply via email to