mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Use find_if when finding things.
This commit is contained in:
parent
e6740046ee
commit
59811ec780
|
@ -40,11 +40,7 @@ struct SmallMap : std::vector<std::pair<T, U> > {
|
|||
*/
|
||||
inline typename std::vector<Pair>::const_iterator Find(const T &key) const
|
||||
{
|
||||
typename std::vector<Pair>::const_iterator it;
|
||||
for (it = std::vector<Pair>::begin(); it != std::vector<Pair>::end(); it++) {
|
||||
if (key == it->first) return it;
|
||||
}
|
||||
return it;
|
||||
return std::find_if(std::vector<Pair>::begin(), std::vector<Pair>::end(), [&key](const Pair &pair) { return key == pair.first; });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue