Lazily Initialized Variables that are Compatible with const/immutable

Vijay Nayar madric at gmail.com
Thu Nov 17 21:49:53 UTC 2022


On Thursday, 17 November 2022 at 15:33:47 UTC, razyk wrote:
> On 17.11.22 13:04, MorteFeuille123 wrote:
>>>

While the solutions from razyk and Ali take care of lazy 
initialization, with Ali's solution also having the benefit of 
being thread-safe, none of these methods are actually compatible 
with `const` or `immutable`, meaning that in any case where lazy 
initialization is needed, you cannot have a const class, you have 
to pick one or the other in the current setup.


More information about the Digitalmars-d mailing list