From 223f67c2cbf4648c3aaa907ec0edf98e53b574e9 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Fri, 13 Jun 2025 13:14:27 +0200 Subject: Avoid unnecessary work in accessing container entries - in sequence containers, use operator[] instead of .at() when accessing indices guaranteed to be in bound; - in associative containers, prefer .find() and reusing the returned const iterator to using .contains() and .at(); while there, make any so obtained iterators const if they are read-only. --- src/buildtool/common/cli.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/buildtool/common/cli.hpp') diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index ff4db0bb..096044e0 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "CLI/CLI.hpp" @@ -705,8 +706,9 @@ static inline auto SetupToAddArguments( app->add_option_function( "--resolve-special", [clargs](auto const& raw_value) { - if (kResolveSpecialMap.contains(raw_value)) { - clargs->resolve_special = kResolveSpecialMap.at(raw_value); + if (auto const it = kResolveSpecialMap.find(raw_value); + it != kResolveSpecialMap.end()) { + clargs->resolve_special = it->second; } else { Logger::Log(LogLevel::Warning, -- cgit v1.2.3