Inspecting __traits(isDeprecated) and deprecation warnings
drug
drug2004 at bk.ru
Thu Sep 26 09:17:07 UTC 2019
On 9/25/19 11:35 PM, Boris Carvajal wrote:
> On Wednesday, 25 September 2019 at 14:20:00 UTC, Anonymouse wrote:
>> I added some deprecations in my project and am going through my
>> templates trying to silence the warnings that suddenly popped up. This
>> template works, but it triggers deprecation warnings when I am
>> actively trying to avoid them.
>
> This code seems to work for classes too and even with DMD "-de" compiler
> switch.
>
> template isMemberDeprecated(T, string name)
> {
> enum isMemberDeprecated = mixin(q{__traits(isDeprecated, }, T, ".",
> name, q{)});
> }
>
> https://run.dlang.io/is/iQbxOC
>
>
It's really nice! Thank you.
More information about the Digitalmars-d-learn
mailing list