Skip to content

Instantly share code, notes, and snippets.

@extrawurst
Created April 15, 2015 01:21
Show Gist options
  • Save extrawurst/82864f72bb97dfea2481 to your computer and use it in GitHub Desktop.
Save extrawurst/82864f72bb97dfea2481 to your computer and use it in GitHub Desktop.
d demplate for Type member
auto foo(T)()
{
pragma(msg, T.stringof);
return __traits(getAttributes, T);
}
pragma(msg, foo(MyType.member)); // leads to "Error: need 'this' for 'member' of type 'bool'"
pragma(msg, __traits(getAttributes, MyType.member)); // works
@extrawurst
Copy link
Author

auto foo(alias T)()
does not change anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment