Is it possible to set function attributes conditionally?

Adam D. Ruppe destructionator at gmail.com
Fri Jun 4 11:36:09 UTC 2021


On Friday, 4 June 2021 at 11:33:32 UTC, wjoe wrote:
> This is a contrived example. In reality I would use this with 
> custom array, hash map and other container implementations so I 
> could use them in @nogc territory by just switching out the 
> allocator.

If they are templates, just don't specify attributes and the 
compiler will infer them for you.

If they are not templates, you have to do a separate copy under 
version or static if.


More information about the Digitalmars-d-learn mailing list