Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The syntax for the type you requested would be <code>std::map&lt;std::string, std::multimap&lt;float, pptr&gt;*&gt;</code>, but you don't need to use a pointer; you could just use <code>std::map&lt;std::string, std::multimap&lt;float, pptr&gt; &gt;</code></p> <p><code>std::map::operator[]</code> automatically default-constructs an entry and inserts it when the key requested is not present so if the mapped type is <code>std::multimap&lt;float, pptr&gt;</code>, it will automatically construct the multimap corresponding to a specific key in the map when it is needed. For example:</p> <pre><code> std::map&lt;std::string, std::multimap&lt;float, pptr&gt; &gt; myMap; std::multimap&lt;float, pptr&gt;&amp; myMap_A = myMap["A"]; </code></pre> <p>If the mapped type is <code>std::multimap&lt;float, pptr&gt;*</code> then it's just a raw pointer, so it would be initialized to <code>nullptr</code> (0), and you would need to manually detect that, allocate a new multimap for that key, and store its address. You would also need to make sure that you iterate through the map and <code>delete</code> all the dynamically allocated multimaps before the map is destroyed, and make sure that you never overwrite a non-null pointer without <code>delete</code>ing its multimap first. All of this is can be avoided by not using raw pointers as the mapped type. In fact, you should in general avoid using raw pointers that have ownership of their data; use <a href="https://stackoverflow.com/questions/106508/what-is-a-smart-pointer-and-when-should-i-use-one/106614#106614">smart pointers</a> instead.</p> <p>One last note: Using floating point types as container keys is somewhat risky, since it's quite easy to encounter values that are not quite equal due to rounding errors.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload