shared members and castings
    nrgyzer 
    nrgyzer at gmail.com
       
    Sat Nov 12 12:20:54 PST 2011
    
    
  
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) {
            std.stdio.writeln(c);
        }
    }
}
Without casting, I always get some errors. My classes contains many different
collections and values, so I've many casts which makes the code at some points
a bit unclear. Is there any way to prevent the casting from/to shared objects?
    
    
More information about the Digitalmars-d-learn
mailing list