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