Question about typeof(*this)

choi heejo azurenote.enseed at gmail.com
Sat Oct 16 22:20:51 PDT 2010


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: template instance main.test!(int) error instantiating

what is the problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20101017/9e3c259b/attachment.html>


More information about the Digitalmars-d-learn mailing list