|
From: Laura L. <lau...@gm...> - 2007-09-27 14:11:03
|
Hello,
Is this the best way to return a vector of Pointers that is an atribute of a
class?? I don't return the vector directly to avoid delete externaly the
pointers Resultado*, because is an attribute of the class.
vector<Resultado*>& ValidacionCruzadaEval::getResultados(){
vector<Resultado*>::const_iterator it;
vector<Resultado*>* copia=new vector<Resultado*>;
copia->reserve(resultados.size());
for(it=resultados.begin();it!=resultados.end();it++){
copia->push_back(new Resultado(**it));
}
return *copia;
}
|