title: how memory allocation happens for map and string in c++
body: <p>I am using global declaration of <code>map&lt;string,string&gt;</code> type.</p>
  
  <ol>
  <li>If i execute the code, is the strings are created in dynamic memory?</li>
  <li>Is the map is created on the dynamic memory or static memory?</li>
  </ol>
  
  <p>-</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;map&gt;
  #include &lt;string&gt; 
  
  std::map&lt;std::string, std::string&gt; mymap;
  
  class myObject
  {
  public:
      myObject()
      {
          mymap["A"] = "AString";
          mymap["B"] = "BString";
          mymap["C"] = "CString";
      }
  };
  
  int main()
  {
      myObject obj1;
      std::cout &lt;&lt; mymap["B"] &lt;&lt; std::endl;
      return 1;
  }
  </code></pre>