diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-04 18:26:39 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-07 14:58:04 +0100 |
commit | 0a8dbe086a23bbb905514007d21e2e04cdaae1e8 (patch) | |
tree | 06136cea09fa30d857cc4f23f15ea372dfe5ef47 /src/buildtool/execution_api/git | |
parent | 3bc0b895258ba8aeb04ee48525036a0a9407c9cb (diff) | |
download | justbuild-0a8dbe086a23bbb905514007d21e2e04cdaae1e8.tar.gz |
IExecutionApi: Use unordered_set in IsAvailable
Diffstat (limited to 'src/buildtool/execution_api/git')
-rw-r--r-- | src/buildtool/execution_api/git/git_api.hpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/buildtool/execution_api/git/git_api.hpp b/src/buildtool/execution_api/git/git_api.hpp index a6ad4196..7fd21005 100644 --- a/src/buildtool/execution_api/git/git_api.hpp +++ b/src/buildtool/execution_api/git/git_api.hpp @@ -24,6 +24,7 @@ #include <optional> #include <string> #include <unordered_map> +#include <unordered_set> #include <utility> #include <vector> @@ -327,12 +328,14 @@ class GitApi final : public IExecutionApi { .has_value(); } - [[nodiscard]] auto IsAvailable(std::vector<ArtifactDigest> const& digests) - const noexcept -> std::vector<ArtifactDigest> override { - std::vector<ArtifactDigest> result; + [[nodiscard]] auto IsAvailable( + std::unordered_set<ArtifactDigest> const& digests) const noexcept + -> std::unordered_set<ArtifactDigest> override { + std::unordered_set<ArtifactDigest> result; + result.reserve(digests.size()); for (auto const& digest : digests) { if (not IsAvailable(digest)) { - result.push_back(digest); + result.emplace(digest); } } return result; |