title: How to access elements of a C++ map from a pointer?
body: <p>Simple question but difficult to formulate for a search engine: if I make a pointer to a map object, how do I access and set its elements? The following code does not work.</p>
  
  <pre><code>map&lt;string, int&gt; *myFruit;
  myFruit["apple"] = 1;
  myFruit["pear"] = 2;
  </code></pre>