D - template self-instantiation
- Norbert Nemec (16/16) Apr 24 2004 Help: What am I doing wrong?
- Ivan Senji (12/28) Apr 24 2004 I think that everyone has this problem at first (I did)
Help: What am I doing wrong? ---------------------- struct test(T) { test!(T) func() { test!(T) res; return res; }; }; int main() { test!(int) a; a = a.func(); return 0; }; ---------------------- The gdc tells me "template instance test!(int) test is not a template declaration"
Apr 24 2004
"Norbert Nemec" <Norbert.Nemec gmx.de> wrote in message news:c6dlsg$235$1 digitaldaemon.com...Help: What am I doing wrong? ---------------------- struct test(T) { test!(T) func() { test!(T) res; return res; }; };I think that everyone has this problem at first (I did) The solution is very simple: struct test(T) { .test!(T) func() { .test!(T) res; return res; } } The solution is . (gives acces to outer scope) and you don't need ; after struct and function declaration.int main() { test!(int) a; a = a.func(); return 0; }; ---------------------- The gdc tells me "template instance test!(int) test is not a template declaration"
Apr 24 2004