<?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 in einer map abspeicher]]></title><description><![CDATA[<p>Hallo,</p>
<p>ist es möglich einen Vector in einer Map abzuspeichern? Mein Kompiler bringt da tonnenweise Fehlermeldungen...</p>
<p>mfg flowni</p>
<p>mein Beispielcode...</p>
<pre><code>std::map&lt;MyClass , std::vector&lt;MyClass&gt; &gt; map_myMap;
...
MyClass o_test;
MyClass o_test1;
std::vector&lt;MyClass&gt; v_myVector;
v_myVector.push_back(o_test1);

map_myMap[o_test] = v_myVector;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/154545/vector-in-einer-map-abspeicher</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 23:44:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/154545.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Jul 2006 07:10:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to vector in einer map abspeicher on Fri, 28 Jul 2006 07:10:52 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ist es möglich einen Vector in einer Map abzuspeichern? Mein Kompiler bringt da tonnenweise Fehlermeldungen...</p>
<p>mfg flowni</p>
<p>mein Beispielcode...</p>
<pre><code>std::map&lt;MyClass , std::vector&lt;MyClass&gt; &gt; map_myMap;
...
MyClass o_test;
MyClass o_test1;
std::vector&lt;MyClass&gt; v_myVector;
v_myVector.push_back(o_test1);

map_myMap[o_test] = v_myVector;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1105830</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1105830</guid><dc:creator><![CDATA[flownfluid]]></dc:creator><pubDate>Fri, 28 Jul 2006 07:10:52 GMT</pubDate></item><item><title><![CDATA[Reply to vector in einer map abspeicher on Fri, 28 Jul 2006 07:20:35 GMT]]></title><description><![CDATA[<p>Und wie lauten die Fehlermeldungen? Soweit ich das sehe ist der Code korrekt. Hat MyClass vielleicht keinen Copy-Constructor?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1105840</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1105840</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Fri, 28 Jul 2006 07:20:35 GMT</pubDate></item><item><title><![CDATA[Reply to vector in einer map abspeicher on Fri, 28 Jul 2006 08:10:54 GMT]]></title><description><![CDATA[<p>Kopierkonstruktor habe ich keinen, da ich nur Float- Attribute in der Klasse habe...</p>
<p>Gruss</p>
<pre><code>/usr/include/c++/3.3.5/bits/stl_tree.h:1323:   instantiated from `std::_Rb_tree_iterator&lt;_Val, _Val&amp;, _Val*&gt; std::_Rb_tree&lt;_Key, _Val, _KeyOfValue, _Compare, _Alloc&gt;::lower_bound(const _Key&amp;) [with _Key = N_VRFParser::FinishElement, _Val = std::pair&lt;const N_VRFParser::FinishElement, std::vector&lt;N_VRFParser::FinishElement, std::allocator&lt;N_VRFParser::FinishElement&gt; &gt; &gt;, _KeyOfValue = std::_Select1st&lt;std::pair&lt;const N_VRFParser::FinishElement, std::vector&lt;N_VRFParser::FinishElement, std::allocator&lt;N_VRFParser::FinishElement&gt; &gt; &gt; &gt;, _Compare = std::less&lt;N_VRFParser::FinishElement&gt;, _Alloc = std::allocator&lt;std::pair&lt;const N_VRFParser::FinishElement, std::vector&lt;N_VRFParser::FinishElement, std::allocator&lt;N_VRFParser::FinishElement&gt; &gt; &gt; &gt;]'
/usr/include/c++/3.3.5/bits/stl_map.h:508:   instantiated from `typename std::_Rb_tree&lt;_Key, std::pair&lt;const _Key, _Tp&gt;, std::_Select1st&lt;std::pair&lt;const _Key, _Tp&gt; &gt;, _Compare, _Alloc&gt;::iterator std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::lower_bound(const _Key&amp;) [with _Key = N_VRFParser::FinishElement, _Tp = std::vector&lt;N_VRFParser::FinishElement, std::allocator&lt;N_VRFParser::FinishElement&gt; &gt;, _Compare = std::less&lt;N_VRFParser::FinishElement&gt;, _Alloc = std::allocator&lt;std::pair&lt;const N_VRFParser::FinishElement, std::vector&lt;N_VRFParser::FinishElement, std::allocator&lt;N_VRFParser::FinishElement&gt; &gt; &gt; &gt;]'
/usr/include/c++/3.3.5/bits/stl_map.h:316:   instantiated from `_Tp&amp; std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::operator[](const _Key&amp;) [with _Key = N_VRFParser::FinishElement, _Tp = std::vector&lt;N_VRFParser::FinishElement, std::allocator&lt;N_VRFParser::FinishElement&gt; &gt;, _Compare = std::less&lt;N_VRFParser::FinishElement&gt;, _Alloc = std::allocator&lt;std::pair&lt;const N_VRFParser::FinishElement, std::vector&lt;N_VRFParser::FinishElement, std::allocator&lt;N_VRFParser::FinishElement&gt; &gt; &gt; &gt;]'
/root/user/zem/workspace/UNT/cobusiness/VRFParser/VRFParserReadFile.cpp:879:   instantiated from here
/usr/include/c++/3.3.5/bits/stl_function.h:197: error: no match for 'operator&lt;' in '__x &lt; __y'
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1105903</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1105903</guid><dc:creator><![CDATA[flownfluid]]></dc:creator><pubDate>Fri, 28 Jul 2006 08:10:54 GMT</pubDate></item><item><title><![CDATA[Reply to vector in einer map abspeicher on Fri, 28 Jul 2006 08:16:55 GMT]]></title><description><![CDATA[<pre><code>error: no match for 'operator&lt;' in '__x &lt; __y'
</code></pre>
<p>du benötigst einen überladenen operator &lt; für deine klasse da map sortiert speichern möchte oder du änderst den _Compare typ</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1105912</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1105912</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Fri, 28 Jul 2006 08:16:55 GMT</pubDate></item><item><title><![CDATA[Reply to vector in einer map abspeicher on Fri, 28 Jul 2006 08:27:02 GMT]]></title><description><![CDATA[<p>Vielen Dank für die schnelle Antwort aber könntest du mir das schnell erklären warum genau der nun einen überladenen Operator braucht und was hat das mit dem Vergleichmechanismus der map zu tun.<br />
Blicke da nicht so genau durch.</p>
<p>Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1105921</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1105921</guid><dc:creator><![CDATA[flownfluid]]></dc:creator><pubDate>Fri, 28 Jul 2006 08:27:02 GMT</pubDate></item><item><title><![CDATA[Reply to vector in einer map abspeicher on Fri, 28 Jul 2006 08:35:43 GMT]]></title><description><![CDATA[<p>Maps werden immer nach ihrem Schlüsseltyp sortiert. Damit das funktioniert, brauchst du ein Vergleichskriterium.<br />
Standardmäßig ist der Comparetyp std::less&lt;KeyType&gt; und std::less ist mit dem &lt;-Operator definiert.<br />
Du hast also 3 Möglichkeiten, den Code zum Laufen zu bringen:<br />
1. Du schreibst einen &lt;-Operator für MyClass (ist aber nur sinnvoll, wenn ein solcher Vergleich tatsächlich logisch möglich ist)<br />
2. Du spezialisierst das std::less-Template für deine Klasse<br />
3. Du schreibst eine eigene Vergleichsfunktion (das Sinnvollste, wenn du nur in einem Kontext eine solche Map anlegst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1105933</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1105933</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Fri, 28 Jul 2006 08:35:43 GMT</pubDate></item><item><title><![CDATA[Reply to vector in einer map abspeicher on Fri, 28 Jul 2006 08:55:13 GMT]]></title><description><![CDATA[<p>Vielen Dank für alles, nun funkt es endlich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f60b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_savoring_food"
      title=":yum:"
      alt="😋"
    /></p>
<p>Gruss flownfluid</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1105947</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1105947</guid><dc:creator><![CDATA[flownfluid]]></dc:creator><pubDate>Fri, 28 Jul 2006 08:55:13 GMT</pubDate></item></channel></rss>