I have a quick question.
I started learning C++ a while ago and have always used vectors with shared pointers of objects in them. Or at least smart pointers.
I'm currently programming a game and I was thinking about why I would use smart pointers.
Assume I have a Game class and it has a vector of players.
When would I want to choose for vector<Player> players and when would i want to choose for vector<shared_ptr<Player>>?
unique_ptr.shared_ptris very niche when used appropriatelyshared_ptr. I listed cases in which I would consider usingshared_ptr. That's the problem with generic questions like this - there are lots of considerations in deciding which option to use, not absolute "thou shalt" type rules.