<?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[std::map - Anfängerfrage]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wenn ich mit einem Schlüssel auf eine std::map zugreife, und es keinen Eintrag zu diesem Schlüssel gibt, was bekomme ich dann zurück?</p>
<p>Danke!<br />
Mitsch</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/147073/std-map-anfängerfrage</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 23:34:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/147073.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 13 May 2006 15:51:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::map - Anfängerfrage on Sat, 13 May 2006 15:51:05 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wenn ich mit einem Schlüssel auf eine std::map zugreife, und es keinen Eintrag zu diesem Schlüssel gibt, was bekomme ich dann zurück?</p>
<p>Danke!<br />
Mitsch</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057143</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057143</guid><dc:creator><![CDATA[Mitsch]]></dc:creator><pubDate>Sat, 13 May 2006 15:51:05 GMT</pubDate></item><item><title><![CDATA[Reply to std::map - Anfängerfrage on Sat, 13 May 2006 15:54:14 GMT]]></title><description><![CDATA[<p>Dann wird ein Eintrag für den Schlüssel eingefügt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057144</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057144</guid><dc:creator><![CDATA[anonymus]]></dc:creator><pubDate>Sat, 13 May 2006 15:54:14 GMT</pubDate></item><item><title><![CDATA[Reply to std::map - Anfängerfrage on Sat, 13 May 2006 15:58:47 GMT]]></title><description><![CDATA[<p>nicht unbedingt, nur wenn du sowas wie</p>
<p>map_[5] = 3; machst.</p>
<p>bei map&lt;int, int&gt;::iterator i = map_.find(5);</p>
<p>wird nichts eingefügt, sondern du bekommst den end()-iterator zurück</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057146</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057146</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Sat, 13 May 2006 15:58:47 GMT</pubDate></item><item><title><![CDATA[Reply to std::map - Anfängerfrage on Sat, 13 May 2006 16:09:34 GMT]]></title><description><![CDATA[<pre><code>scenario * scenerylist::getbyName(char * index)
{
     return scen_map[std::string(index)];
}
</code></pre>
<p>ist mein code-sniplet. Wenn ich einen unbekannten index verwende, sollte er doch einen NULL-Pointer zurückgeben, oder stehe ich auf der Leitung?</p>
<p>Mitsch</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057151</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057151</guid><dc:creator><![CDATA[Mitsch]]></dc:creator><pubDate>Sat, 13 May 2006 16:09:34 GMT</pubDate></item><item><title><![CDATA[Reply to std::map - Anfängerfrage on Sat, 13 May 2006 16:33:48 GMT]]></title><description><![CDATA[<p>Mitsch schrieb:</p>
<blockquote>
<pre><code>scenario * scenerylist::getbyName(char * index)
{
     return scen_map[std::string(index)];
}
</code></pre>
<p>ist mein code-sniplet. Wenn ich einen unbekannten index verwende, sollte er doch einen NULL-Pointer zurückgeben, oder stehe ich auf der Leitung?</p>
<p>Mitsch</p>
</blockquote>
<p>Das würde sogar funktionieren denn wenn kein Elememt mit dem Key index existiert dann wird ein neuer scenario * in die map eingefügt der mit null initialisiert ist. Auf diese weise wird aber bei jedem zugriff auf einen nicht vorhandenen Key die map immer grösser.<br />
Es wäre also besser wenn du mit find das Element suchst und wenn nichts gefunden wird einfach 0 zurückgibst.<br />
Kurt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057162</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057162</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Sat, 13 May 2006 16:33:48 GMT</pubDate></item><item><title><![CDATA[Reply to std::map - Anfängerfrage on Sat, 13 May 2006 18:33:30 GMT]]></title><description><![CDATA[<p>Uh, heisser Tipp, vielen Dank - da wäre ich nie draufgekommen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Werde ich gleich mal testen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057219</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057219</guid><dc:creator><![CDATA[Mitsch]]></dc:creator><pubDate>Sat, 13 May 2006 18:33:30 GMT</pubDate></item></channel></rss>