UDA inheritance

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Sep 10 13:06:41 UTC 2020


Hello folks,

Is there any way to define UDAs such that they automatically 
inherit other UDA definitions?

For example, suppose I define:

     enum BaseUDA { A, B }

Is there a way to define `AnotherUDA` such that if `hasUDA!(T, 
AnotherUDA)` then it is a given that `hasUDA!(T, BaseUDA)` will 
also be true?  (And similarly for the `A`, `B` specializations?)

The use-case here is to create a UDA that defines some general 
distinction of code properties, and to allow downstream code to 
define its own more specialized cases of that distinction.

Thanks in advance for any thoughts or advice!

Thanks and best wishes,

       -- Joe


More information about the Digitalmars-d-learn mailing list