<div dir="ltr"><br><br><div class="gmail_quote">On Tue, Apr 28, 2009 at 11:08 AM, Shachar Shemesh <span dir="ltr"><<a href="mailto:shachar@shemesh.biz">shachar@shemesh.biz</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr" bgcolor="#ffffff" text="#000000"><div class="im">
Erez D wrote:<br>
<blockquote type="cite">
<div dir="ltr"> c2<int> gen_c2(int a)<br>
{<br>
c2<int> ret(a);<br>
return ret;<br>
}<br>
</div>
</blockquote></div>
It would seem to me that this line instantiates c2<int>, so that<div class="im"><br>
<blockquote type="cite">
<div dir="ltr">template <> class c2<int> : public
c1<int><br>
{<br>
public:<br>
c2(int &a):c1(a) {};<br>
};<br>
<br>
</div>
</blockquote></div>
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.<br>
</div></blockquote><div><br>I can't write c2 first as it is derived out of c1<br>I can't write c1 first as it has a function that returns c2<br>if i use forward declaration (like i did), i get "specialization after instanciation"<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr" bgcolor="#ffffff" text="#000000"><br>
Try to have gen_c2 return a pointer to c2<int>. That may resolve
the problem.<br>
</div></blockquote><div>no, it doesnt.<br><br>i am sure that there is a solution to this.<br>but i don't know what it is.<br><br>thanks,<br>erez. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr" bgcolor="#ffffff" text="#000000"><br>
Shachar<br>
<pre cols="72">--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
<a href="http://www.lingnu.com" target="_blank">http://www.lingnu.com</a>
</pre>
</div>
</blockquote></div><br></div>