![]() |
#2
秀痘魔导士2010-04-01 13:36
|
下面的函数运行速度非常慢,哪些地方有问题呢?谢谢!
// Find the address of the company with the given name.
string FindAddress( list<Company> companies, string name )
{
for( list<Company>::iterator i = companies.begin(); i != companies.end(); i++ )
{
if( *i == name )
{
return (*i).address;
}
}
return "";
}