How do I catch an exception caused from std::map?
<p>I have declared a map like this </p>

<pre><code>map&lt;long long, list&lt;SoundInfo *&gt; &gt; m_soundListMap;
</code></pre>

<p>and I also have this function</p>

<pre><code>void addSoundInfo(long long deviceId, SoundInfo * info)
</code></pre>

<p>I am trying to add sound info associate with the device id as the key into the map. In this function, I assumed that a key and value pair has been added to the map. So I can retrieve the list of the sound info and add incoming sound info to the back of the list.</p>

<p>I want to catch an exception for the case that the map doesn't have the key then I can create the key and value pair and insert into the map. </p>

<p>How do I catch this exception in C++?</p>

<p>Thanks in advance...</p>
