template UDA

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 7 17:47:53 PDT 2015


On Monday, 7 September 2015 at 22:03:13 UTC, Adam D. Ruppe wrote:
> [...]

digging deeper, this very contrived example compiles:

struct S(T) { int x; }

auto fun(alias T, S)(S x) {
     return T!S(x);
}

void main(string[] args) {
     auto s = fun!S(123);
     writeln(s.x);
}

So I suppose the existing behaviour shouldn't really be 
considered a bug.

This syntax would sure be nice though:

struct MyAttribute(T = _UDA_TARGET_) { }


More information about the Digitalmars-d mailing list