This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
If I want to pass a derived* to something that takes a parent*, that just works and is awesome. On the other hand, passing a shared_ptr<derived> to something that takes a shared_ptr<parent> because the templates are considered completely different classes. This breaks the usual OO "derived IS A parent" relationship. So far, I have been doing a lot of shared_ptr_cast to make it work as I try to migrate an older style code base to use shared pointers, but keeping the API which used to be fairly nice to work with is turning out pretty ugly.
Is there an easier way to pass a derived class with shared pointers that I should be doing instead?
Subreddit
Post Details
- Posted
- 9 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/cpp_questio...