Re: shared members and castings

2011-11-14 Thread Steven Schveighoffer
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)(); }

shared members and castings

2011-11-12 Thread nrgyzer
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) {

Re: shared members and castings

2011-11-12 Thread Andrej Mitrovic
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?

Re: shared members and castings

2011-11-12 Thread Andrej Mitrovic
Btw a quicker way to cast away shared is to use: foreach (ref c; cast()ex)