<?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[[gelöst] array von arrays - initialisierung]]></title><description><![CDATA[<p>Ich brauche ein Array von verschieden langen Arrays von Zahlen.<br />
Also sowas:</p>
<pre><code class="language-cpp">{
   {53, 55, 72},
   {1, 5, 20, 90},
   {15, 102},
   ...
}
</code></pre>
<p>Ich dachte jetzt an ein Array von valarrays oder vectors, das Problem ist aber die Initialisierung, da das ganze Ding const werden soll.<br />
Geht das irgendwie einfacher als</p>
<pre><code class="language-cpp">int temp[3][7] = {
   {53, 55, 72},
   {1, 5, 20, 90},
   {15, 102}
   };
const valarray&lt;int&gt; va[3] = {
   valarray&lt;int&gt;(temp[0], 3),
   valarray&lt;int&gt;(temp[1], 4),
   valarray&lt;int&gt;(temp{2], 2)
   };
</code></pre>
<p>?<br />
(Das array ist nämlich ziemlich lang)</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/263400/gelöst-array-von-arrays-initialisierung</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 20:25:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/263400.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 20 Mar 2010 10:55:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [gelöst] array von arrays - initialisierung on Sat, 20 Mar 2010 12:53:53 GMT]]></title><description><![CDATA[<p>Ich brauche ein Array von verschieden langen Arrays von Zahlen.<br />
Also sowas:</p>
<pre><code class="language-cpp">{
   {53, 55, 72},
   {1, 5, 20, 90},
   {15, 102},
   ...
}
</code></pre>
<p>Ich dachte jetzt an ein Array von valarrays oder vectors, das Problem ist aber die Initialisierung, da das ganze Ding const werden soll.<br />
Geht das irgendwie einfacher als</p>
<pre><code class="language-cpp">int temp[3][7] = {
   {53, 55, 72},
   {1, 5, 20, 90},
   {15, 102}
   };
const valarray&lt;int&gt; va[3] = {
   valarray&lt;int&gt;(temp[0], 3),
   valarray&lt;int&gt;(temp[1], 4),
   valarray&lt;int&gt;(temp{2], 2)
   };
</code></pre>
<p>?<br />
(Das array ist nämlich ziemlich lang)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1871569</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1871569</guid><dc:creator><![CDATA[wx++]]></dc:creator><pubDate>Sat, 20 Mar 2010 12:53:53 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] array von arrays - initialisierung on Sat, 20 Mar 2010 11:22:35 GMT]]></title><description><![CDATA[<p>nimm doch vector&lt; vector&lt;int&gt; &gt;<br />
oder etwas vergleichbares aus der stl 8also list, deque doer sosntwas was du halt brauchst)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1871577</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1871577</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sat, 20 Mar 2010 11:22:35 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] array von arrays - initialisierung on Sat, 20 Mar 2010 11:31:02 GMT]]></title><description><![CDATA[<p>Inwiefern würde das die Initialisierung vereinfachen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1871578</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1871578</guid><dc:creator><![CDATA[wx++]]></dc:creator><pubDate>Sat, 20 Mar 2010 11:31:02 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] array von arrays - initialisierung on Sat, 20 Mar 2010 12:15:59 GMT]]></title><description><![CDATA[<p>Du könntest deine STL Strutkur z.B aus einem nativen Array generieren lassen, oder halt die Werte aus einem File einlesen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1871597</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1871597</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sat, 20 Mar 2010 12:15:59 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] array von arrays - initialisierung on Sat, 20 Mar 2010 12:53:41 GMT]]></title><description><![CDATA[<blockquote>
<p>Du könntest deine STL Strutkur z.B aus einem nativen Array generieren lassen</p>
</blockquote>
<p>Das war ja mein Beispiel aus dem ersten Post, das nur leider bei einem Array mit mehreren Hundert Einträgen viel Schreibarbeit erfordert.<br />
Ich habe den Code jetzt von einem kleinen Hilfsprogramm generieren lassen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1871610</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1871610</guid><dc:creator><![CDATA[wx++]]></dc:creator><pubDate>Sat, 20 Mar 2010 12:53:41 GMT</pubDate></item></channel></rss>