On Sunday, 28 December 2014 at 20:36:07 UTC, ketmar via Digitalmars-d-learn wrote:
you can turn that method to template. for now it is virtual method and
compiler is unable to inline it.

Are you suggesting something like the following...

void lock(alias m)() if(is(typeof(m) == shared(Mutex))) {
  (cast(Mutex)m).lock();
}

void unlock(alias m)() if(is(typeof(m) == shared(Mutex))) {
  (cast(Mutex)m).unlock();
}

...and then calling lock!mySharedMutex() and unlock!mySharedMutex()? Is there a way to generate a bunch of these in a similar way to `alias this`?

Reply via email to