Optimize identity lookup

Now the string gets concatenated only once, instead of every time
the lambda gets called.

Change-Id: I2cae8cf3c5830ef37c2d1d2d1b90bbb86b4cb648
diff --git a/src/static_schema.cpp b/src/static_schema.cpp
index a3649ae..6d28626 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -184,7 +184,7 @@
 
     auto topLevelModule = location.m_nodes.empty() ? node.first.get() : location.m_nodes.front().m_prefix.get().m_name;
     auto identModule = value.first ? value.first.value() : topLevelModule;
-    return std::any_of(identities.begin(), identities.end(), [identModule, value](const auto& x) { return x == identModule + ":" + value.second; });
+    return std::any_of(identities.begin(), identities.end(), [toFind = identModule + ":" + value.second](const auto& x) { return x == toFind; });
 }
 
 bool StaticSchema::isLeaf(const schemaPath_& location, const ModuleNodePair& node) const
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 3512baf..ca9e4ff 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -176,7 +176,7 @@
 
     auto topLevelModule = location.m_nodes.empty() ? node.first.get() : location.m_nodes.front().m_prefix.get().m_name;
     auto identModule = value.first ? value.first.value() : topLevelModule;
-    return std::any_of(identities.begin(), identities.end(), [identModule, value](const auto& x) { return x == identModule + ":" + value.second; });
+    return std::any_of(identities.begin(), identities.end(), [toFind = identModule + ":" + value.second](const auto& x) { return x == toFind; });
 }
 
 bool YangSchema::listHasKey(const schemaPath_& location, const ModuleNodePair& node, const std::string& key) const