<?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[fill pointer array?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte ein Pointer Array: T* foo[5]; mit NULL füllen.<br />
Probiert habe ich das so:<br />
fill(foo, foo+5, NULL);<br />
aber dann meckert mein Compiler immer:</p>
<blockquote>
<p>Error 22 error C2440: '=' : cannot convert from 'const int' to 'T *' d:\microsoft visual studio 8\vc\include\xutility 2949</p>
</blockquote>
<p>Weiß wer wie das geht?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/204947/fill-pointer-array</link><generator>RSS for Node</generator><lastBuildDate>Thu, 08 Oct 2026 22:04:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/204947.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 08 Feb 2008 14:49:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to fill pointer array? on Fri, 08 Feb 2008 14:49:21 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte ein Pointer Array: T* foo[5]; mit NULL füllen.<br />
Probiert habe ich das so:<br />
fill(foo, foo+5, NULL);<br />
aber dann meckert mein Compiler immer:</p>
<blockquote>
<p>Error 22 error C2440: '=' : cannot convert from 'const int' to 'T *' d:\microsoft visual studio 8\vc\include\xutility 2949</p>
</blockquote>
<p>Weiß wer wie das geht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1452023</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1452023</guid><dc:creator><![CDATA[abgefüllter]]></dc:creator><pubDate>Fri, 08 Feb 2008 14:49:21 GMT</pubDate></item><item><title><![CDATA[Reply to fill pointer array? on Fri, 08 Feb 2008 15:36:53 GMT]]></title><description><![CDATA[<p>memset(foo, sizeof(foo), 0); ?<br />
fill(foo, foo+5, (T*)0); ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1452059</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1452059</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Fri, 08 Feb 2008 15:36:53 GMT</pubDate></item><item><title><![CDATA[Reply to fill pointer array? on Fri, 08 Feb 2008 15:59:09 GMT]]></title><description><![CDATA[<p>Fellhuhns Varianten (memset muss nicht funktionieren und passt logisch nicht), oder<br />
fill_n(foo,sizeof foo/sizeof *foo, (T*)0);</p>
<pre><code class="language-cpp">template&lt;typename T&gt; struct identity { typedef T type; };
template&lt;typename T, std::size_t N&gt;
void fill_array(T (&amp;arr)[N], const typename identity&lt;T&gt;::type&amp; value = T())
{
    std::fill_n( arr, N, value );
}
...
T* foo[5];
fill_array(foo);
fill_array(foo,0);
</code></pre>
<p>bei der Definition automatischer oder statischer Variablen:<br />
T* foo[5] = {};<br />
bei nichtstatischem Member foo: in der ctor-Initialisierungsliste<br />
: foo()<br />
bei new[]:<br />
new T*[5]()</p>
<p>...<br />
...</p>
<p>new(&amp;foo) T*[5]()</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1452064</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1452064</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Fri, 08 Feb 2008 15:59:09 GMT</pubDate></item><item><title><![CDATA[Reply to fill pointer array? on Fri, 08 Feb 2008 20:10:27 GMT]]></title><description><![CDATA[<p>Frage hat sich erledigt!!!! Danke!!!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1452226</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1452226</guid><dc:creator><![CDATA[abgefüllter]]></dc:creator><pubDate>Fri, 08 Feb 2008 20:10:27 GMT</pubDate></item></channel></rss>