title: Correct way to initialize a map and delete in C++
body: <p>I am trying to create a static map declared in the constructor of my class.
  This map is to be initialized and filled with data in one method and free'd in another method.
  Is this the correct way to do it?</p>
  
  <pre><code>using namespace std;
  #include &lt;map&gt;
  
  struct a {
       string b;
       string c;
  }
  
  class aClass:public myClass
   {
   public:
        aClass();
        virtual ~aClass();
  
   private: 
        map&lt;string, a&gt; myMap;
        void method(int a);
        void amethod(int b);
   }
   void aClass::method(int a)
   {
        myMap = new map&lt;string, a&gt;;
        // Addition of elements;
   }
   void aClass::amethod(int b)
   {
        // retrival of elements
        myMap.clear();
        delete myMap;
   }
  </code></pre>