D equivalent of C++11's function local static initialization?

Timothee Cour via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 16 20:08:39 PDT 2017


NOTE: curious about both cases:
* thread local
* shared

On Tue, May 16, 2017 at 8:04 PM, Timothee Cour <thelastmammoth at gmail.com> wrote:
> what's the best D equivalent of C++11's function local static initialization?
> ```
> void fun(){
>   static auto a=[](){
>     //some code
>    return some_var;
>   }
> }
> ```
>
> (C++11 guarantees thread safety)


More information about the Digitalmars-d-learn mailing list