<?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[Vectoren in array ablegen?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe Vektoren unterschiedlicher Länge und würde diese gerne in ein Array ablegen, damit ich auf jedes Element eines bestimmten Vektors zugreifen kann.</p>
<p>z.b. vector 5 element 2</p>
<p>Wie gehe ich vor?<br />
Über ein 2D-Array kann ich es nicht machen, da ich dort eine fixe Größe angeben muss, richtig?<br />
Deswegen vermute ich, dass ich es über Vektoren realisieren muss.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/327768/vectoren-in-array-ablegen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Jul 2026 14:30:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/327768.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Sep 2014 09:09:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 09:09:44 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe Vektoren unterschiedlicher Länge und würde diese gerne in ein Array ablegen, damit ich auf jedes Element eines bestimmten Vektors zugreifen kann.</p>
<p>z.b. vector 5 element 2</p>
<p>Wie gehe ich vor?<br />
Über ein 2D-Array kann ich es nicht machen, da ich dort eine fixe Größe angeben muss, richtig?<br />
Deswegen vermute ich, dass ich es über Vektoren realisieren muss.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2415910</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415910</guid><dc:creator><![CDATA[NaHibi]]></dc:creator><pubDate>Wed, 03 Sep 2014 09:09:44 GMT</pubDate></item><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 09:11:41 GMT]]></title><description><![CDATA[<p>du kannst vectoren auch in vectoren ablegen: std::vector&lt;std::vector&lt;int&gt;&gt;, allerdings ist so nicht gewährleistet, dass die inneren vectoren alle gleich groß sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2415911</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415911</guid><dc:creator><![CDATA[daddy_felix]]></dc:creator><pubDate>Wed, 03 Sep 2014 09:11:41 GMT</pubDate></item><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 09:28:45 GMT]]></title><description><![CDATA[<p>Danke für deine Antwort.</p>
<p>Und Vektoren kann man aber nicht nicht Arrays ablegen?<br />
Weil meine Anzahl der Vektoren ist fix nur die Länge der einzelnen Vektoren ist unterschiedlich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2415914</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415914</guid><dc:creator><![CDATA[NaHibi]]></dc:creator><pubDate>Wed, 03 Sep 2014 09:28:45 GMT</pubDate></item><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 09:30:16 GMT]]></title><description><![CDATA[<p>du könntest ein std::array nehmen:</p>
<p>std::array&lt;std::vector&lt;int&gt;, VECTOR_COUNT&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2415915</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415915</guid><dc:creator><![CDATA[daddy_felix]]></dc:creator><pubDate>Wed, 03 Sep 2014 09:30:16 GMT</pubDate></item><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 09:32:41 GMT]]></title><description><![CDATA[<p>NaHibi schrieb:</p>
<blockquote>
<p>Und Vektoren kann man aber nicht nicht Arrays ablegen?</p>
</blockquote>
<p>Klar kann man das, warum machst du es nicht einfach?</p>
<pre><code>std::vector&lt;int&gt; v[10];
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2415917</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415917</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 03 Sep 2014 09:32:41 GMT</pubDate></item><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 10:21:49 GMT]]></title><description><![CDATA[<p>Danke, so werde ich es machen.</p>
<p>Kann man mehrere Werte auch in einer Zeile hinzufügen, oder muss ich das für jeden Wert einzlen machen?</p>
<p>v[0].push_back(10);<br />
v[0].push_back(20);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2415927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415927</guid><dc:creator><![CDATA[NaHibi]]></dc:creator><pubDate>Wed, 03 Sep 2014 10:21:49 GMT</pubDate></item><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 11:07:07 GMT]]></title><description><![CDATA[<p>Klar kannst du mehrere Elemente auf einmal in den Vector schieben. Die insert-Methode hat ja eine Überladung, die ein Iterator-Range-Paar erwartet. <a href="http://www.cplusplus.com/reference/vector/vector/insert/" rel="nofollow">Ref</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2415935</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415935</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Wed, 03 Sep 2014 11:07:07 GMT</pubDate></item><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 13:50:14 GMT]]></title><description><![CDATA[<p>vector&lt;int&gt; testv;<br />
testv.insert (testv.begin(), 2, 10 );</p>
<p>Wie ich das verstehe, kann ich nur mehrere Elemente mit dem gleichen Wert hinzufügen.<br />
Kann ich auch beliebige Werte hinzufügen?<br />
z.B. 10 20 23</p>
<p>Wenn ja, wie?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2415954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415954</guid><dc:creator><![CDATA[NaHibi]]></dc:creator><pubDate>Wed, 03 Sep 2014 13:50:14 GMT</pubDate></item><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 14:00:17 GMT]]></title><description><![CDATA[<pre><code>std::array&lt;std::vector&lt;float&gt;, 10&gt; arr;

for(auto &amp; vec : arr)
{
	float insertions[] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f };
	vec.insert(std::end(vec), std::begin(insertions), std::end(insertions)); // per Iterator Range Pair
	vec.insert(std::end(vec), { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }); // per Initializer_list
}
</code></pre>
<p>(Frage an die anderen: Ist die Syntax mit der lnitializer_list so richtig?)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2415955</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415955</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Wed, 03 Sep 2014 14:00:17 GMT</pubDate></item><item><title><![CDATA[Reply to Vectoren in array ablegen? on Wed, 03 Sep 2014 14:31:13 GMT]]></title><description><![CDATA[<p>Skym0sh0 schrieb:</p>
<blockquote>
<p>Frage an die anderen: Ist die Syntax mit der lnitializer_list so richtig?</p>
</blockquote>
<p>Ja. Den Zuweisungsoperator kannst noch weglassen.</p>
<p>Oder, aus der Kategorie &quot;noch mehr Spaß mit Klammern&quot;:</p>
<pre><code class="language-cpp">#include &lt;array&gt;
#include &lt;vector&gt;
#include &lt;iostream&gt;

int main()
{
	std::array&lt; std::vector&lt; int &gt;, 4 &gt; arr
	{{
		{  1,  2,  3,  4,  5 },
		{  6,  7,  8,  9, 10 },
		{ 11, 12, 13, 14, 15 },
		{ 16, 17, 18, 19, 20 }
	}};

	for( auto &amp; vec : arr ) {
		for( auto &amp; i : vec )
			std::cout &lt;&lt; i &lt;&lt; ' ';
		std::cout.put( '\n' );
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2415961</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2415961</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 03 Sep 2014 14:31:13 GMT</pubDate></item></channel></rss>