mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-05 02:27:45 +00:00
Return early from ArgMap::find
This commit is contained in:
parent
50f14f225c
commit
06f3abe26d
10
format.h
10
format.h
@ -1681,13 +1681,13 @@ class ArgMap {
|
||||
FMT_API void init(const ArgList &args);
|
||||
|
||||
const internal::Arg* find(const fmt::BasicStringRef<Char> &name) const {
|
||||
typename MapType::const_iterator it = map_.begin();
|
||||
// the list is unsorted, so just return the first matching name.
|
||||
for (; it != map_.end(); ++it) {
|
||||
// The list is unsorted, so just return the first matching name.
|
||||
for (typename MapType::const_iterator it = map_.begin(), end = map_.end();
|
||||
it != end; ++it) {
|
||||
if (it->first == name)
|
||||
break;
|
||||
return &it->second;
|
||||
}
|
||||
return it != map_.end() ? &it->second : 0;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user