title: initialise a deque of vector pointers
body: <pre><code>class MD { 
      MD();
      MD(const MD &amp;obj);
      MD&amp; operator=(const MD &amp;obj);
    private:
      int Name;
      double sal;
  };
  
  typedef std::shared_ptr&lt;MD&gt; mDataPtr;
  typedef std::vector&lt;mDataPtr&gt; mDataVecContr;
  typedef std::shared_ptr&lt;mDataVecContr&gt; ptrMdataVecContr;
  
  class MDataContainer{
    public:
      MDataContainer();
      MDataContainer(const MDataContainer &amp;mDataCont);
      MDataContainer&amp; operator=(const MDataContainer &amp;mDataCont);
  
    private:
      mDataVecContr vecNode;
      std::deque&lt;ptrMdataVectContr&gt; mDataQueContr;
  };
  </code></pre>
  
  <p>My requirement is to store 500 object of type MD in a vector then I am keeping pointer to these vectors in deque. The problem here is how to initialize this list in copy contructor MDataContainer(const MDataContainer &amp;mDataCont) and assign it in overloaded assignment operator MDataContainer&amp; operator=(const MDataContainer &amp;mDataCont). To get rid of code duplication I am using Init function. Pls explain me a method which can give better performance. Some rough way I am already using. Can we have some algo or some other library(boost I am not having gr8 idea) which can be used to solve this kind of problem.</p>