@@ -274,8 +274,15 @@ auto any::operator[](const any& rhs) const -> const any& {
274274auto any::contains(const char key[]) const -> bool {
275275 const any& variant = unthunkVariant(*this);
276276 assert(variant.type == Type::Map);
277− for (any::map::const_iterator it = variant.m->begin(), end = variant.m->end(); it != end; ++it) {
278− if (it->first == key || strcmp(it->first, key) == 0) {
277+ const any::map::const_iterator begin = variant.m->begin();
278+ const any::map::const_iterator end = variant.m->end();
279+ for (any::map::const_iterator it = begin; it != end; ++it) {
280+ if (it->first == key) {
281+ return true;
282+ }
283+ }
284+ for (any::map::const_iterator it = begin; it != end; ++it) {
285+ if (strcmp(it->first, key) == 0) {
279286 return true;
280287 }
281288 }