Weird behavior with UDAs

realhet real_het at hotmail.com
Sat Jun 13 13:08:29 UTC 2020


On Saturday, 13 June 2020 at 12:55:36 UTC, realhet wrote:
> Hello, I have a problem I can't even understand with the code

For the first I realized that an UDA can be a type too, and come 
up with this:

template getUDA(alias a, U){
   enum u = q{ getUDAs!(a, U)[$-1] };
     static if(hasUDA!(a, U) && !is(mixin(u)))
       enum getUDA = mixin(u);
     else
       enum getUDA = U.init;
}

So I always get an instance of the UDA with the default values.

But the second question is still beyond me:

How can be a string represented with 'null' by default instead on 
`""`. Unless I state it explicitly with name="" ? o.O


More information about the Digitalmars-d-learn mailing list