What is the best way to program over "abstract" types in D?

Adam D. Ruppe destructionator at gmail.com
Sat Nov 23 15:09:44 UTC 2019


On Saturday, 23 November 2019 at 13:17:49 UTC, mipri wrote:
>   template isNamed(alias T) {
>       enum isNamed = hasStaticMember!(T, "secretlyIsNamed");
>   }

this looks like a place to use a @Named uda!

@Named struct World {}
@Named struct Bob {}

or mebbe

@implements!Named

is an option to explore too. Then it cleans up the 
secretlyIsNamed reflection issue.


More information about the Digitalmars-d-learn mailing list