note that if you do it this way you should really wrap vector in a class so that patients are deleted in the destructor e.g.
Code:
class PatientColl
{
std::vector<patient*> m_patients;
static void DeletePatient(patient *pPatient)
{
delete pPatient;
}
public:
~PatientColl()
{
for_each(m_patients.begin(), m_patients.end(), DeletePatient);
}
void AddPatient(patient *pPatient)
{
m_patients.push_back(pPatient);
}
};
or you could save yourself the trouble and use a boost.PtrContainer which does this for you (see my sig)