any tool to at least partially convert C++ to D (htod for source

Walter Bright newshound1 at digitalmars.com
Wed Mar 10 11:28:15 PST 2010


Max Samukha wrote:
> Still looking for a solution. Basically, there should be a way to enable 
> the following:
> 
> module a;
> 
> template Foo()
> {
>     static int a;
>     static this()
>     {
>        a = 42;
>     }
> }
> 
> ----
> module b;
> import c;
> import a;
> 
> mixin Foo;
> 
> ----
> module c;
> import b;
> import a;
> 
> mixin Foo;

template Foo()
{
     static int _a;
     static int a()
     {
         static bool _a_inited;
         if (!_a_inited)
         {    _a_inited = true;
              _a = 42;
         }
         return _a;
     }
}



More information about the Digitalmars-d mailing list