How do smart pointers work in C++11, and in what scenarios would you choose std::weak_ptr over std::shared_ptr?