<?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 Element mit Key XXX vorhanden?]]></title><description><![CDATA[<p>Hi Leute!<br />
Es geht um eine Otto-Normal-std::map.<br />
Wie kann ich am sinnvollsten herausfinden, ob ein Element mit dem Key XXX vorhanden ist?</p>
<p>Bisher hab ich immer einen try-Block um dan operator[] gemacht.<br />
Ich bin aber sicher es geht besser.</p>
<p>Ein Snippet wäre gut.<br />
Vielen Dank im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/222065/std-map-element-mit-key-xxx-vorhanden</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 11:42:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/222065.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 07 Sep 2008 11:40:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::map Element mit Key XXX vorhanden? on Sun, 07 Sep 2008 11:40:04 GMT]]></title><description><![CDATA[<p>Hi Leute!<br />
Es geht um eine Otto-Normal-std::map.<br />
Wie kann ich am sinnvollsten herausfinden, ob ein Element mit dem Key XXX vorhanden ist?</p>
<p>Bisher hab ich immer einen try-Block um dan operator[] gemacht.<br />
Ich bin aber sicher es geht besser.</p>
<p>Ein Snippet wäre gut.<br />
Vielen Dank im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1578012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1578012</guid><dc:creator><![CDATA[Blaze]]></dc:creator><pubDate>Sun, 07 Sep 2008 11:40:04 GMT</pubDate></item><item><title><![CDATA[Reply to std::map Element mit Key XXX vorhanden? on Sun, 07 Sep 2008 11:44:01 GMT]]></title><description><![CDATA[<p>1. Benutze find(..) um herauszufinden, ob ein Key schon existiert.<br />
2. Mit dem [] operator wird der entsprechnde Key, wenn nicht schon existent, eingetragen. (try- catch bringt rein gar nichts).</p>
<p>Simon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1578013</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1578013</guid><dc:creator><![CDATA[simon.gysi]]></dc:creator><pubDate>Sun, 07 Sep 2008 11:44:01 GMT</pubDate></item><item><title><![CDATA[Reply to std::map Element mit Key XXX vorhanden? on Sun, 07 Sep 2008 12:49:48 GMT]]></title><description><![CDATA[<p>so in der Art sollte es funktionieren:</p>
<pre><code class="language-cpp">std::map&lt;T&gt;::iterator it = m.find(key);

if ( it != m.end() )
{
  // key existiert  
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1578028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1578028</guid><dc:creator><![CDATA[_tsd_]]></dc:creator><pubDate>Sun, 07 Sep 2008 12:49:48 GMT</pubDate></item></channel></rss>