Re: Aliasing of template results

2012-01-25 Thread Manu
On 22 January 2012 20:36, Alex Rønne Petersen xtzgzo...@gmail.com wrote: On 22-01-2012 19:33, Andrej Mitrovic wrote: A while ago there was a suggestion by Andrei to incorporate this sort of syntax: template ElementType(T : T[]) { alias ElementType = T; } struct Foo(T) { alias

Re: Aliasing of template results

2012-01-24 Thread Denis Shelomovskij
22.01.2012 22:33, Andrej Mitrovic пишет: A while ago there was a suggestion by Andrei to incorporate this sort of syntax: template ElementType(T : T[]) { alias ElementType = T; } struct Foo(T) { alias Type = T; } I think people agreed it was a nice syntax, but I don't know if anyone

Re: Aliasing of template results

2012-01-24 Thread Denis Shelomovskij
22.01.2012 18:51, Alex Rønne Petersen пишет: Hi, Someone on IRC wanted to know the element type of an array type and the following code was suggsted: template ElementType(T : T[]) { alias T ElementType; } He was confused about how ElementType!(int[]) could possibly equal int, until we

Re: Aliasing of template results - alias bar = foo

2012-01-23 Thread Nick Treleaven
On 22/01/2012 18:33, Andrej Mitrovic wrote: A while ago there was a suggestion by Andrei to incorporate this sort of syntax: template ElementType(T : T[]) { alias ElementType = T; } struct Foo(T) { alias Type = T; } I think people agreed it was a nice syntax, but I don't know if

Re: Aliasing of template results

2012-01-23 Thread Jesse Phillips
On Sunday, 22 January 2012 at 14:51:36 UTC, Alex Rønne Petersen wrote: So we started discussing whether a more intuitive syntax could be found. Someone suggsted: template ElementType(T : T[]) { alias T template; } I personally believe this makes it perfectly clear that you're aliasing the

Aliasing of template results

2012-01-22 Thread Alex Rønne Petersen
Hi, Someone on IRC wanted to know the element type of an array type and the following code was suggsted: template ElementType(T : T[]) { alias T ElementType; } He was confused about how ElementType!(int[]) could possibly equal int, until we explained that the alias does, in fact,

Re: Aliasing of template results

2012-01-22 Thread sclytrack
On 01/22/2012 03:51 PM, Alex Rønne Petersen wrote: Hi, Someone on IRC wanted to know the element type of an array type and the following code was suggsted: template ElementType(T : T[]) { alias T ElementType; } He was confused about how ElementType!(int[]) could possibly equal int, until we

Re: Aliasing of template results

2012-01-22 Thread Denis Shelomovskij
22.01.2012 18:51, Alex Rønne Petersen пишет: Hi, Someone on IRC wanted to know the element type of an array type and the following code was suggsted: template ElementType(T : T[]) { alias T ElementType; } He was confused about how ElementType!(int[]) could possibly equal int, until we

Re: Aliasing of template results

2012-01-22 Thread Timon Gehr
On 01/22/2012 07:07 PM, Denis Shelomovskij wrote: 22.01.2012 18:51, Alex Rønne Petersen пишет: Hi, Someone on IRC wanted to know the element type of an array type and the following code was suggsted: template ElementType(T : T[]) { alias T ElementType; } He was confused about how

Re: Aliasing of template results

2012-01-22 Thread Alex Rønne Petersen
On 22-01-2012 19:07, Denis Shelomovskij wrote: 22.01.2012 18:51, Alex Rønne Petersen пишет: Hi, Someone on IRC wanted to know the element type of an array type and the following code was suggsted: template ElementType(T : T[]) { alias T ElementType; } He was confused about how

Re: Aliasing of template results

2012-01-22 Thread Andrej Mitrovic
A while ago there was a suggestion by Andrei to incorporate this sort of syntax: template ElementType(T : T[]) { alias ElementType = T; } struct Foo(T) { alias Type = T; } I think people agreed it was a nice syntax, but I don't know if anyone tried to implement it.

Re: Aliasing of template results

2012-01-22 Thread Alex Rønne Petersen
On 22-01-2012 19:33, Andrej Mitrovic wrote: A while ago there was a suggestion by Andrei to incorporate this sort of syntax: template ElementType(T : T[]) { alias ElementType = T; } struct Foo(T) { alias Type = T; } I think people agreed it was a nice syntax, but I don't know if

Re: Aliasing of template results

2012-01-22 Thread Denis Shelomovskij
22.01.2012 22:11, Timon Gehr пишет: On 01/22/2012 07:07 PM, Denis Shelomovskij wrote: 22.01.2012 18:51, Alex Rønne Petersen пишет: Hi, Someone on IRC wanted to know the element type of an array type and the following code was suggsted: template ElementType(T : T[]) { alias T ElementType; }