<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Initialize an array of objects by referencing the constructor directly]]></title><description><![CDATA[<p>Hallo</p>
<p>Wie es grundsätzlich funktioniert habe ich verstanden<br />
<a href="http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectsbyreferencingtheconstructordirectly.htm" rel="nofollow">http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectsbyreferencingtheconstructordirectly.htm</a></p>
<p>aber, wie muss ich das bei Templates schreiben?</p>
<pre><code>static CDelayEvent&lt;int&gt; Events[MAX_EVENTS] =
{
   CDelayEvent&lt;int&gt;( 0, 0, -1, &amp;Value1, &amp;Value2 ),
   CDelayEvent&lt;int&gt;( 0, 0, -1, &amp;Value3, &amp;Value4 )
};
</code></pre>
<p>error C2440: 'initializing' : 'class CDelayEvent&lt;int&gt;' kann nicht in 'class CDelayEvent&lt;int&gt;' konvertiert werden</p>
<p>Danke für eure Hilfe!</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/244892/initialize-an-array-of-objects-by-referencing-the-constructor-directly</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 03:06:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/244892.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 07 Jul 2009 11:31:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Initialize an array of objects by referencing the constructor directly on Tue, 07 Jul 2009 11:31:33 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Wie es grundsätzlich funktioniert habe ich verstanden<br />
<a href="http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectsbyreferencingtheconstructordirectly.htm" rel="nofollow">http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectsbyreferencingtheconstructordirectly.htm</a></p>
<p>aber, wie muss ich das bei Templates schreiben?</p>
<pre><code>static CDelayEvent&lt;int&gt; Events[MAX_EVENTS] =
{
   CDelayEvent&lt;int&gt;( 0, 0, -1, &amp;Value1, &amp;Value2 ),
   CDelayEvent&lt;int&gt;( 0, 0, -1, &amp;Value3, &amp;Value4 )
};
</code></pre>
<p>error C2440: 'initializing' : 'class CDelayEvent&lt;int&gt;' kann nicht in 'class CDelayEvent&lt;int&gt;' konvertiert werden</p>
<p>Danke für eure Hilfe!</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1738484</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1738484</guid><dc:creator><![CDATA[xx_happymozart_xx]]></dc:creator><pubDate>Tue, 07 Jul 2009 11:31:33 GMT</pubDate></item><item><title><![CDATA[Reply to Initialize an array of objects by referencing the constructor directly on Tue, 07 Jul 2009 11:44:15 GMT]]></title><description><![CDATA[<p>CDelayEvent&lt;int&gt; hat auch einen passenden Konstruktor für Deine 5 Werte???</p>
<p>Folgendes Minimalbeispiel tut es nämlich:</p>
<pre><code>template &lt;typename T&gt;
struct A
{
   A(T t1, T t2, T t3, T t4, T t5) {}
};

int main()
{
  static A&lt;int&gt; a[2] =
  {
     A&lt;int&gt;( 0, 0, -1, -2, -3 ),
     A&lt;int&gt;( 0, 0, -1, -5, -9 )
  };
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1738496</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1738496</guid><dc:creator><![CDATA[jencas]]></dc:creator><pubDate>Tue, 07 Jul 2009 11:44:15 GMT</pubDate></item><item><title><![CDATA[Reply to Initialize an array of objects by referencing the constructor directly on Tue, 07 Jul 2009 11:55:53 GMT]]></title><description><![CDATA[<p>Der Copy-Ctor von CDelayEvent&lt;int&gt; muss vorhanden sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1738510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1738510</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Tue, 07 Jul 2009 11:55:53 GMT</pubDate></item><item><title><![CDATA[Reply to Initialize an array of objects by referencing the constructor directly on Tue, 07 Jul 2009 13:15:40 GMT]]></title><description><![CDATA[<p>Danke für eure antworten.</p>
<p>Stimmt - hab jetzt ein kleines Sample geschrieben und dort funktioniert es auch (ohne Copy-Kontruktor) - das Programm wo das Problem auftritt ist nicht von mir geschrieben!</p>
<p>Wieso muss da ein Copy-Kontruktor vorhanden sein - versteh ich noch nicht.<br />
Aber stimmt - da steht sogar noch was in der nächsten Zeile - sorry, übersehen<br />
Kein Kopierkonstruktor für class 'CDelayEvent&lt;int&gt;' verfuegbar</p>
<p>Danke!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1738568</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1738568</guid><dc:creator><![CDATA[xx_happymozart_xx]]></dc:creator><pubDate>Tue, 07 Jul 2009 13:15:40 GMT</pubDate></item><item><title><![CDATA[Reply to Initialize an array of objects by referencing the constructor directly on Tue, 07 Jul 2009 14:05:16 GMT]]></title><description><![CDATA[<p>Also unter Visual C++ 6.0 wird der Copy-Kontruktor benötigt. Unter Visual Studio 2005 nicht - man sieht dort aber im *.asm nicht, dass er hier etwas ähnliches machen würde.</p>
<p>Und die Probleme treten nur mit den Template-Klassen auf. Sonst geht es ja!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1738636</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1738636</guid><dc:creator><![CDATA[xx_happymozart_xx]]></dc:creator><pubDate>Tue, 07 Jul 2009 14:05:16 GMT</pubDate></item><item><title><![CDATA[Reply to Initialize an array of objects by referencing the constructor directly on Tue, 07 Jul 2009 14:25:09 GMT]]></title><description><![CDATA[<p>In der Klasse wird CList verwendet - daher wird der Copy-Konstruktur benötigt.</p>
<p>Danke und schönen Abend noch</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1738646</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1738646</guid><dc:creator><![CDATA[xx_happymozart_xx]]></dc:creator><pubDate>Tue, 07 Jul 2009 14:25:09 GMT</pubDate></item></channel></rss>