On Sun, 28 Dec 2014 20:21:45 +0000 Aiden via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> Thanks for the information. At least I've discovered a reasonably > tidy way of wrapping Mutex up so that it's not quite as painful > casting everything: > > shared class SharedMutex { > private Mutex mutex; > > private @property Mutex unsharedMutex() { > return cast(Mutex)mutex; > } > > this() { > mutex = cast(shared)new Mutex(); > } > > alias unsharedMutex this; > } > > SharedMutex can just be used like a normal Mutex, which is pretty > neat. `alias this` is awesome! you can turn that method to template. for now it is virtual method and compiler is unable to inline it.
signature.asc
Description: PGP signature