On Friday, 2 November 2018 at 04:18:47 UTC, Neia Neutuladh wrote:
On Fri, 02 Nov 2018 04:01:00 +0000, Nicholas Wilson wrote:
By noting that all (interesting for the purpose of UDA's i.e.
not void)
types have a .init
or you could do
static if (is(typeof(uda) == Foo) || is(uda == Foo))
Which, again, only tests for presence, when I want to check for
presence *and* get the value, which should be Foo.init if the
person supplied the raw type.
template GetMeTheValue(value...) if(value.length == 1)
{
static if (is(typeof(value[0].init == value[0]) // A type
enum GetMeTheValue = value[0].init;
else
enum GetMeTheValue = value[0];
}
...
static if (is(typeof(GetMeTheValue!uda) == Foo)