mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-13 07:40:06 +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);
|
FMT_API void init(const ArgList &args);
|
||||||
|
|
||||||
const internal::Arg* find(const fmt::BasicStringRef<Char> &name) const {
|
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.
|
||||||
// the list is unsorted, so just return the first matching name.
|
for (typename MapType::const_iterator it = map_.begin(), end = map_.end();
|
||||||
for (; it != map_.end(); ++it) {
|
it != end; ++it) {
|
||||||
if (it->first == name)
|
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