title: C++: access to container of shared_ptr should return raw or shared ptr?
body: <p>If I use a container of shared_ptrs and explicitely allow access to its elements, should I return shared_ptrs or raw pointers if I intend the container to be the one responsible for "cleaning up"?</p>
  
  <pre><code>class Container
  {
  private:
      std:vector&lt;shared_ptr&lt;Foo&gt; &gt; foo_ptrs;
  
  public:
      shared_ptr&lt;Foo&gt; operator[](std::size_t index) const {}; // or
      Foo* operator[](std::size_t index) const {};
  };
  </code></pre>
  
  <p>Is there a reason to return shared_ptrs in such a situation, or are raw pointers OK?</p>
  
  <p>Greets!</p>