From 32fec587b5f3a57eb2247cd98929b663017d6e00 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 24 Aug 2019 15:32:15 -0400 Subject: [PATCH] hecl/hecl: Collapse InProgress() into std::any_of() Same thing, more straightforward. --- hecl/lib/hecl.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hecl/lib/hecl.cpp b/hecl/lib/hecl.cpp index c64a4ca24..85550b49f 100644 --- a/hecl/lib/hecl.cpp +++ b/hecl/lib/hecl.cpp @@ -129,10 +129,8 @@ static std::unordered_map PathsInProgress; bool ResourceLock::InProgress(const ProjectPath& path) { std::unique_lock lk{PathsMutex}; - for (const auto& p : PathsInProgress) - if (p.second == path) - return true; - return false; + return std::any_of(PathsInProgress.cbegin(), PathsInProgress.cend(), + [&path](const auto& entry) { return entry.second == path; }); } bool ResourceLock::SetThreadRes(const ProjectPath& path) {