title: Is there C++ lazy pointer?
body: <p>I need a <code>shared_ptr</code> like object, but which automatically creates a real object when I try to access its members.</p>
  
  <p>For example, I have:</p>
  
  <pre><code>class Box
  {
  public:
      unsigned int width;
      unsigned int height;
      Box(): width(50), height(100){}
  };
  
  std::vector&lt; lazy&lt;Box&gt; &gt; boxes;
  boxes.resize(100);
  
  // at this point boxes contain no any real Box object.
  // But when I try to access box number 50, for example,
  // it will be created.
  
  std::cout &lt;&lt; boxes[49].width;
  
  // now vector contains one real box and 99 lazy boxes.
  </code></pre>
  
  <p>Is there some implementation, or I should to write my own?</p>