July 11, 2019 Alias function with arguments | ||||
---|---|---|---|---|
| ||||
Is it possible to alias a function and its arguments, but for that function to only be evaluated when the alias is used? For example alias pragma(inline, true) inline inline void func(){} |
July 13, 2019 Re: Alias function with arguments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jamie | On Thursday, 11 July 2019 at 03:13:43 UTC, Jamie wrote: > Is it possible to alias a function and its arguments, but for that function to only be evaluated when the alias is used? For example > > alias pragma(inline, true) inline > > inline > void func(){} What you're asking for is possible (see https://run.dlang.io/is/2Lh4Dr for example). However I don't believe the code sample you're showing is possible, because aliases always evaluate to types or values and you can't use either of those as a function attribute. Also pragmas are not functions. |
Copyright © 1999-2021 by the D Language Foundation