another c++ q (with specialization and inheritance )
Shachar Shemesh
shachar at shemesh.biz
Tue Apr 28 11:08:27 IDT 2009
Erez D wrote:
> c2<int> gen_c2(int a)
> {
> c2<int> ret(a);
> return ret;
> }
It would seem to me that this line instantiates c2<int>, so that
> template <> class c2<int> : public c1<int>
> {
> public:
> c2(int &a):c1(a) {};
> };
>
is an attempt to specialized a class that has already been instantiated
from the generic template. The compiler has no way to go back and change
the storage size for c2<int>, which it already needed to know when
compiling the lines above.
Try to have gen_c2 return a pointer to c2<int>. That may resolve the
problem.
Shachar
--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20090428/3bc33cdd/attachment.html>
More information about the Linux-il
mailing list