Re: How to create immutable struct?

2012-10-06 Thread bearophile

denizzzka:


How to pass immutable to new?


One solution:

struct Cell {}
void main() {
auto s = new immutable(Cell)();
}

Bye,
bearophile


Re: How to create immutable struct?

2012-10-06 Thread denizzzka

I should just create immutable constructor :-)


How to create immutable struct?

2012-10-06 Thread denizzzka

I am have struct with constructor:

immutable struct Cell {
...
}

And I trying to create instance of this struct:

immutable (Cell)* s = new Cell( v, s);

compiler returns error:

Error: cannot implicitly convert expression (new Cell(v,s)) of 
type Cell* to immutable(Cell)*


How to pass immutable to new?