is my code to get CTFE instantiated object valid D ?

chmike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 28 09:09:07 PDT 2016


On Saturday, 28 May 2016 at 08:47:48 UTC, Kagamin wrote:
> For a trick of static mutable allocation see 
> https://github.com/dlang/druntime/pull/1325

In the following instruction of the above commit, what effect has 
the [] after init ?

  _store[0 .. __traits(classInstanceSize, T)] = typeid(T).init[];

T is a template argument that is a class derived from Error.

I couldn't find an explanation here 
https://dlang.org/spec/property.html#init.

I saw that this is a concise implementation of what is being done 
in emplace().




More information about the Digitalmars-d-learn mailing list