Boost logo

Boost :

From: Michael Goldshteyn (mgoldshteyn_at_[hidden])
Date: 2005-12-12 15:35:32


It is my understanding that ptr_containers allow and support pointers to
polymorphic types. But, the following does not appear to be possible:

class Animal
{
};

class Cow: public Animal
{
};

ptr_vector<Cow> cows;
ptr_vector<Animal> animals;

...
// Add in some cows to the cows container
...

// Transfer all cows to the animal container
// Error: transfer() is not a class member function template
// it expects the "from" container to be of the same types of pointers
animals.transfer(animals.end(),cows.begin(),cows.end(),cows);

Thanks,

Mike


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk