On Sat, 12 Nov 2011 15:20:54 -0500, nrgyzer nrgy...@gmail.com wrote:
Hi guys,
is there any way to use shared members without casting them? Fox example:
class Example {
private shared HashSet!(string) ex;
...
this() {
ex = cast(shared) new HashSet!(string)();
}
Hi guys,
is there any way to use shared members without casting them? Fox example:
class Example {
private shared HashSet!(string) ex;
...
this() {
ex = cast(shared) new HashSet!(string)();
}
void write() {
foreach (ref c; cast(HashSet!(string)) ex) {
First one can be:
ex = new shared(HashSet!(string));
I don't know about foreach/opApply, I guess each library has to
implemented shared support manually?
Btw a quicker way to cast away shared is to use:
foreach (ref c; cast()ex)