Re: Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:17:31 UTC, Meta wrote: Urgh, I'm all messed up now. The results in the second case are correct, but the results in the first case are wrong, as !canBeAlias!true should be !false, not !true. I also get the same results with __traits(compiles, { alias _ = T[0]; }).

Re: Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:11:12 UTC, Meta wrote: Yeah, definitely wrong. template canBeAlias(T...) if (T.length == 1) { static if (is(typeof({alias _ = T[0];}))) { enum canBeAlias = true; } else { enum canBeAlias = false

Re: Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 20:36:34 UTC, anonymous wrote: I get an error on your code: "test.d(16): Error: static assert (canBeAlias!(true)) is false". But when commenting out the first assert (line 15), there's no error. Hmm, I might have made a mistake reducing my actual code. Played arou

Re: Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread anonym...@example.com via Digitalmars-d-learn
On Sunday, 8 March 2015 at 15:41:23 UTC, Meta wrote: template canBeAlias(T...) if (T.length == 1) { static if (is(typeof({alias _ = T[0];}))) { enum canBeAlias = true; } else { enum canBeAlias = false; } } pragma(msg

Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread Meta via Digitalmars-d-learn
template canBeAlias(T...) if (T.length == 1) { static if (is(typeof({alias _ = T[0];}))) { enum canBeAlias = true; } else { enum canBeAlias = false; } } pragma(msg, canBeAlias!canBeAlias); //prints "true" static asser