From 82405cf49946440722a3b28412493907b3a1dde8 Mon Sep 17 00:00:00 2001 From: David Neto Date: Thu, 11 Aug 2016 15:34:26 -0400 Subject: [PATCH] Reuse the iterator on Id and type lookup --- source/opt/type_manager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/opt/type_manager.cpp b/source/opt/type_manager.cpp index 22941c6..1e8bd33 100644 --- a/source/opt/type_manager.cpp +++ b/source/opt/type_manager.cpp @@ -35,12 +35,14 @@ namespace opt { namespace analysis { Type* TypeManager::GetType(uint32_t id) const { - if (id_to_type_.count(id) != 0) return id_to_type_.at(id).get(); + auto iter = id_to_type_.find(id); + if (iter != id_to_type_.end()) return (*iter).second.get(); return nullptr; } uint32_t TypeManager::GetId(Type* type) const { - if (type_to_id_.count(type) != 0) return type_to_id_.at(type); + auto iter = type_to_id_.find(type); + if (iter != type_to_id_.end()) return (*iter).second; return 0; } -- 2.7.4