Ok so this is a problem i stumbled upon the other day. I have a couple of ideas that i will keep to myself for the early part of this topic, so i don't taint the replies.
I have a codebase in which everything reference counted, so:
class CB : public class CA
{
};
Then we have declarations like the following:
RefCtd< CA > A;
RefCtd< CB > B;
What is required of class
RefCtd for me to be able to store a collection of A's:
std::vector< A > myCollection;
and be able to store smart-pointed entities of derrived classes to it, like so:
myCollection.push_back( InstanceOfB );
Is this accomplishable? If so, what would you do/ have you done?
Thanks,