Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

0
Passing derived shared_ptr
Post Flair (click to view more posts with a particular flair)
Post Body

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?

Author
Account Strength
100%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
34,129
Link Karma
127
Comment Karma
33,450
Profile updated: 3 days ago
Posts updated: 19 hours ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
9 years ago