returning of the iterator in C++
- by helloWorld
can somebody explain I can I return list iterator?
list<Account>::iterator Company::findAccount(int id){
for(list<Account>::iterator i = listOfAccounts.begin(); i != listOfAccounts.end(); ++i){
if(i->getID() == id){
return i;
}
}
return 0;
}
and also is it good practice, to return list iterator?
edited
also can use this function in the statesments:
if(findAccount(id)){
throw "hey";
return;
}