HeadUnshared in core.atomic

Mike Franklin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 11 22:29:37 PDT 2014


Hello,

I was recently exposed to this template in core.atomic:

private
{
     template HeadUnshared(T)
     {
         static if( is( T U : shared(U*) ) )
             alias shared(U)* HeadUnshared;
         else
             alias T HeadUnshared;
     }
}

Could someone please explain/elaborate on what this is doing, and 
why it's necessary and used so often in core.atomic?

Thanks,
Mike


More information about the Digitalmars-d-learn mailing list