Mixin templates accessing mixed out scope

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 12 07:30:15 PDT 2015


On 09/12/2015 06:37 AM, Prudence wrote:
>
> Says the creating new SingleStore is not an expression

Reduced:

mixin template ObjectStore(TKey)
{
     class SingleStore
     {
         static void New()    // Removing 'static' compiles
         {
             new SingleStore();
         }
     }
}

class MyStore
{
     mixin ObjectStore!(int);
}

void main()
{
     auto s = new MyStore();
}

Error: type SingleStore is not an expression

Ali



More information about the Digitalmars-d-learn mailing list