Question about typeof(*this)

2010-10-17 Thread choi heejo
hi there, please read this code: import std.stdio; struct test(T) { alias typeof(*this) type; T a; } void main() { test!(int).type t; t.a = 123; writeln(t.a); } I guessed it would work. but the compiler said: main.d(7): Error: can only * a pointer, not a 'test!(int)' main.d(14): Error:

Re: Question about typeof(*this)

2010-10-17 Thread Ivo Kasiuk
choi heejo wrote: hi there, please read this code: import std.stdio; struct test(T) { alias typeof(*this) type; T a; } void main() { test!(int).type t; t.a = 123; writeln(t.a); } I guessed it would work. but the compiler said: main.d(7): Error: can only *

Re: Question about typeof(this)

2010-09-14 Thread Don
Jacob Carlborg wrote: On 2010-09-10 16:53, Pelle wrote: On 09/10/2010 03:20 PM, Jacob Carlborg wrote: On 2010-09-07 22:32, Don wrote: Jacob Carlborg wrote: On 2010-09-07 17:29, Don wrote: Jacob Carlborg wrote: I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it

Re: Question about typeof(this)

2010-09-12 Thread Jacob Carlborg
On 2010-09-10 16:53, Pelle wrote: On 09/10/2010 03:20 PM, Jacob Carlborg wrote: On 2010-09-07 22:32, Don wrote: Jacob Carlborg wrote: On 2010-09-07 17:29, Don wrote: Jacob Carlborg wrote: I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it says: typeof(this) will

Re: Question about typeof(this)

2010-09-10 Thread Jacob Carlborg
On 2010-09-07 22:32, Don wrote: Jacob Carlborg wrote: On 2010-09-07 17:29, Don wrote: Jacob Carlborg wrote: I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it says: typeof(this) will generate the type of what this would be in a non-static member function, even if

Re: Question about typeof(this)

2010-09-10 Thread Pelle
On 09/10/2010 03:20 PM, Jacob Carlborg wrote: On 2010-09-07 22:32, Don wrote: Jacob Carlborg wrote: On 2010-09-07 17:29, Don wrote: Jacob Carlborg wrote: I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it says: typeof(this) will generate the type of what this

Question about typeof(this)

2010-09-07 Thread Jacob Carlborg
I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it says: typeof(this) will generate the type of what this would be in a non-static member function, even if not in a member function. From that I got the impression that the code below would print the same result,

Re: Question about typeof(this)

2010-09-07 Thread Don
Jacob Carlborg wrote: I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it says: typeof(this) will generate the type of what this would be in a non-static member function, even if not in a member function. From that I got the impression that the code below would

Re: Question about typeof(this)

2010-09-07 Thread Stanislav Blinov
07.09.2010 17:00, Jacob Carlborg пишет: I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it says: typeof(this) will generate the type of what this would be in a non-static member function, even if not in a member function. From that I got the impression that the

Re: Question about typeof(this)

2010-09-07 Thread Jacob Carlborg
On 2010-09-07 17:29, Don wrote: Jacob Carlborg wrote: I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it says: typeof(this) will generate the type of what this would be in a non-static member function, even if not in a member function. From that I got the

Re: Question about typeof(this)

2010-09-07 Thread Jacob Carlborg
On 2010-09-07 17:34, Stanislav Blinov wrote: 07.09.2010 17:00, Jacob Carlborg пишет: I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it says: typeof(this) will generate the type of what this would be in a non-static member function, even if not in a member function.

Re: Question about typeof(this)

2010-09-07 Thread Don
Jacob Carlborg wrote: On 2010-09-07 17:29, Don wrote: Jacob Carlborg wrote: I'm reading http://www.digitalmars.com/d/2.0/declaration.html#Typeof where it says: typeof(this) will generate the type of what this would be in a non-static member function, even if not in a member function. From