[Issue 1827] Uniform syntax for is(), static if, alias, template definition & static assert
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 5 14:01:57 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1827
--- Comment #7 from Trass3r <mrmocool at gmx.de> 2012-01-05 14:01:49 PST ---
(In reply to comment #5)
> The nastiest hack that I see is
>
> template MyTemplate(T:T)
>
> Hands up everyone who knows what that means, and in what way (T:T) is
> different from (T)? If you don't know, can you guess?
>
> Well, the answer is that (T) will match int, const(int) and
> invariant(int), but in all three cases, T will be int. Whereas, (T:T)
> will match the same three things, but now T will be int, const(int)
> and invariant(int) respectively.
At least that's not true anymore.
template Bla(T:T)
{
pragma(msg, T);
}
template Blub(T)
{
pragma(msg, T);
}
alias Bla!(int) A;
alias Bla!(const int) B;
alias Bla!(immutable int) C;
alias Blub!(int) D;
alias Blub!(const int) E;
alias Blub!(immutable int) F;
$ dmd -c test7.d
int
const(int)
immutable(int)
int
const(int)
immutable(int)
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list