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"?
class Container
{
private:
std:vector<shared_ptr<Foo> > foo_ptrs;
public:
shared_ptr<Foo> operator[](std::size_t index) const {}; // or
Foo* operator[](std::size_t index) const {};
};
Is there a reason to return shared_ptrs in such a situation, or are raw pointers OK?
Greets!