<?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[vector will nicht push_back machen (Typkonversion nötig?!?)]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe da ein Problem mit einem Vector.<br />
Ich will hier ein Hash-Table / Dictionary erstellen und habe Probleme bei der push_back Operation. Ich glaube/befürchte, ich muss eine Typkonversion machen.</p>
<p>Danke für eure Tipps!</p>
<p>...<br />
typedef int koord [2];<br />
static map&lt;string, vector&lt;int&gt; &gt; hotTable;</p>
<p>...<br />
...</p>
<p>void searchSpot(string query, int f, vector&lt;koord&gt; Hotspots_temp)<br />
{<br />
map&lt;string, vector&lt;int&gt; &gt;::iterator iter;<br />
iter = hotTable.find(query); // O(log(n)) <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
if (iter != hotTable.end()){<br />
for (int z=0; z&lt;= iter-&gt;second.size()-1; ++z){<br />
koord HSgefunden = {iter-&gt;<a href="http://second.at" rel="nofollow">second.at</a>(z), f};<br />
Hotspots_temp.push_back(HSgefunden); // hier kommt der Fehler (außerhalb der Datei):<br />
560 ...\include\c++\3.4.2\bits\stl_vector.h instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::push_back(const _Tp&amp;) [with _Tp = int[2], _Alloc = std::allocator&lt;int[2]&gt;]'</p>
<p>}</p>
<p>}<br />
}</p>
<p>PS: benutze Dev-C++</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/130166/vector-will-nicht-push_back-machen-typkonversion-nötig</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 15:13:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/130166.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Dec 2005 13:28:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to vector will nicht push_back machen (Typkonversion nötig?!?) on Tue, 20 Dec 2005 13:28:57 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe da ein Problem mit einem Vector.<br />
Ich will hier ein Hash-Table / Dictionary erstellen und habe Probleme bei der push_back Operation. Ich glaube/befürchte, ich muss eine Typkonversion machen.</p>
<p>Danke für eure Tipps!</p>
<p>...<br />
typedef int koord [2];<br />
static map&lt;string, vector&lt;int&gt; &gt; hotTable;</p>
<p>...<br />
...</p>
<p>void searchSpot(string query, int f, vector&lt;koord&gt; Hotspots_temp)<br />
{<br />
map&lt;string, vector&lt;int&gt; &gt;::iterator iter;<br />
iter = hotTable.find(query); // O(log(n)) <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
if (iter != hotTable.end()){<br />
for (int z=0; z&lt;= iter-&gt;second.size()-1; ++z){<br />
koord HSgefunden = {iter-&gt;<a href="http://second.at" rel="nofollow">second.at</a>(z), f};<br />
Hotspots_temp.push_back(HSgefunden); // hier kommt der Fehler (außerhalb der Datei):<br />
560 ...\include\c++\3.4.2\bits\stl_vector.h instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::push_back(const _Tp&amp;) [with _Tp = int[2], _Alloc = std::allocator&lt;int[2]&gt;]'</p>
<p>}</p>
<p>}<br />
}</p>
<p>PS: benutze Dev-C++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/946291</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946291</guid><dc:creator><![CDATA[kannFehlerNichtVerstehen]]></dc:creator><pubDate>Tue, 20 Dec 2005 13:28:57 GMT</pubDate></item><item><title><![CDATA[Reply to vector will nicht push_back machen (Typkonversion nötig?!?) on Tue, 20 Dec 2005 13:37:23 GMT]]></title><description><![CDATA[<p>Kannst du mal die komplette Fehlermeldung ausgeben? (aber es könnte ein Problem damit geben, daß &quot;const int[2]&amp;&quot; nicht definiert ist)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/946298</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946298</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Tue, 20 Dec 2005 13:37:23 GMT</pubDate></item><item><title><![CDATA[Reply to vector will nicht push_back machen (Typkonversion nötig?!?) on Tue, 20 Dec 2005 14:21:27 GMT]]></title><description><![CDATA[<p>array-typedefs sind mit vorsicht zu geniessen (weil man ihnen das array-sein nicht ansieht). und arrays erfüllen die container-requirements nicht (Copy-Constructible/Assignable) - folglich ist ein std::vector&lt;koord&gt; ill-formed/UB.<br />
mach aus dem typedef ein struct und es müsste funktionieren.</p>
<p>edit: boost:array bzw. std::tr1::array bieten sich auch an</p>
]]></description><link>https://www.c-plusplus.net/forum/post/946315</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946315</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Tue, 20 Dec 2005 14:21:27 GMT</pubDate></item><item><title><![CDATA[Reply to vector will nicht push_back machen (Typkonversion nötig?!?) on Tue, 20 Dec 2005 14:58:26 GMT]]></title><description><![CDATA[<p>danke für die schnelle antwort!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/946354</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946354</guid><dc:creator><![CDATA[danke]]></dc:creator><pubDate>Tue, 20 Dec 2005 14:58:26 GMT</pubDate></item><item><title><![CDATA[Reply to vector will nicht push_back machen (Typkonversion nötig?!?) on Wed, 21 Dec 2005 12:46:59 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich dachte, der Fehler wäre behoben, ist er aber nicht. Nachdem ich das ganze Proggy umgeschrieben haben und andere Typen benutze, hängt es wieder an dem Vektor. Ich brauche den Cektor, um Koordinaten dynamische zu speichern. Deshalb habe ich mich für einen vector&lt;int[2]&gt; entschieden (geht das bzw gibts den überhaupt?!?). Aber da mackert mir der Compiler... diverse Fehler, die ich im folgenden aufliste:</p>
<p>560 ...\Dev-Cpp\include\c++\3.4.2\bits\stl_vector.h instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::push_back(const _Tp&amp;) [with _Tp = int[2], _Alloc = std::allocator&lt;int[2]&gt;]'</p>
<p>...Dev-Cpp\include\c++\3.4.2\bits\vector.tcc In member function `void std::vector&lt;_Tp, _Alloc&gt;::_M_insert_aux(__gnu_cxx::__normal_iterator&lt;typename _Alloc::pointer, std::vector&lt;_Tp, _Alloc&gt; &gt;, const _Tp&amp;) [with _Tp = int[2], _Alloc = std::allocator&lt;int[2]&gt;]':</p>
<p>564 ...\Dev-Cpp\include\c++\3.4.2\bits\stl_vector.h instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::push_back(const _Tp&amp;) [with _Tp = int[2], _Alloc = std::allocator&lt;int[2]&gt;]'</p>
<p>..ich hoffe auf Hilfe!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/947003</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/947003</guid><dc:creator><![CDATA[...fehler nicht behoben]]></dc:creator><pubDate>Wed, 21 Dec 2005 12:46:59 GMT</pubDate></item><item><title><![CDATA[Reply to vector will nicht push_back machen (Typkonversion nötig?!?) on Wed, 21 Dec 2005 12:51:47 GMT]]></title><description><![CDATA[<p>...fehler nicht behoben schrieb:</p>
<blockquote>
<p>Deshalb habe ich mich für einen vector&lt;int[2]&gt; entschieden (geht das bzw gibts den überhaupt?!?).</p>
</blockquote>
<p>Wie camper oben sagte, geht das nicht - das Template benötigt bestimmte Operationen (z.B. einen Copy-Construktor für den Elementtyp), um instanziiert zu werden, und die hat ein C-Array leider nicht.</p>
<p>Also solltest du dich anstelle von int[2] für einen anderen Typ entscheiden, um deine Koordinaten aufzunehmen - z.B. ein struct aus zwei int-Elementen:</p>
<pre><code class="language-cpp">//Diese Struktur ist STL-tauglich ;)
struct koord
{
  int x,y;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/947006</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/947006</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Wed, 21 Dec 2005 12:51:47 GMT</pubDate></item><item><title><![CDATA[Reply to vector will nicht push_back machen (Typkonversion nötig?!?) on Wed, 21 Dec 2005 12:56:13 GMT]]></title><description><![CDATA[<p>jetzt verstehe ich...</p>
<p>danke</p>
<p>PS: ich bin echt super erstaunt, dass man hier soooooooooooooo schnelle eine Antwort bekommt. TOLL</p>
]]></description><link>https://www.c-plusplus.net/forum/post/947015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/947015</guid><dc:creator><![CDATA[...ich verstehe]]></dc:creator><pubDate>Wed, 21 Dec 2005 12:56:13 GMT</pubDate></item><item><title><![CDATA[Reply to vector will nicht push_back machen (Typkonversion nötig?!?) on Wed, 21 Dec 2005 13:27:18 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>...ich verstehe schrieb:</p>
<blockquote>
<p>PS: ich bin echt super erstaunt, dass man hier soooooooooooooo schnelle eine Antwort bekommt. TOLL</p>
</blockquote>
<p>Das geht mir uach immer so.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/947043</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/947043</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 21 Dec 2005 13:27:18 GMT</pubDate></item><item><title><![CDATA[Reply to vector will nicht push_back machen (Typkonversion nötig?!?) on Wed, 21 Dec 2005 13:33:18 GMT]]></title><description><![CDATA[<p>Stellt nicht so einfache Fragen, dann kommen die Antworten nicht so schnell oder gar nicht. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/947050</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/947050</guid><dc:creator><![CDATA[tipp2]]></dc:creator><pubDate>Wed, 21 Dec 2005 13:33:18 GMT</pubDate></item></channel></rss>