Skip to content

Commit

Permalink
Remove HashMap alias (#961)
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui authored Jul 23, 2024
1 parent 594441d commit f85bddf
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
7 changes: 4 additions & 3 deletions src/Algos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <sstream>
#include <string>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>

Expand All @@ -26,10 +27,10 @@ bool commandExists(std::string_view cmd) noexcept;
template <typename T>
std::vector<std::string>
topoSort(
const HashMap<std::string, T>& list,
const HashMap<std::string, std::vector<std::string>>& adjList
const std::unordered_map<std::string, T>& list,
const std::unordered_map<std::string, std::vector<std::string>>& adjList
) {
HashMap<std::string, u32> inDegree;
std::unordered_map<std::string, u32> inDegree;
for (const auto& var : list) {
inDegree[var.first] = 0;
}
Expand Down
9 changes: 5 additions & 4 deletions src/BuildConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <tbb/parallel_for.h>
#include <tbb/spin_mutex.h>
#include <thread>
#include <unordered_map>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -98,10 +99,10 @@ struct BuildConfig {
std::string packageName;
fs::path buildOutDir;

HashMap<std::string, Variable> variables;
HashMap<std::string, std::vector<std::string>> varDeps;
HashMap<std::string, Target> targets;
HashMap<std::string, std::vector<std::string>> targetDeps;
std::unordered_map<std::string, Variable> variables;
std::unordered_map<std::string, std::vector<std::string>> varDeps;
std::unordered_map<std::string, Target> targets;
std::unordered_map<std::string, std::vector<std::string>> targetDeps;
std::optional<HashSet<std::string>> phony;
std::optional<HashSet<std::string>> all;

Expand Down
3 changes: 2 additions & 1 deletion src/Cli.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <span>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>

class Opt;
Expand Down Expand Up @@ -183,7 +184,7 @@ class Subcmd : public CliBase<Subcmd>, public ShortAndHidden<Subcmd> {
};

class Cli : public CliBase<Cli> {
HashMap<std::string_view, Subcmd> subcmds;
std::unordered_map<std::string_view, Subcmd> subcmds;
std::vector<Opt> globalOpts;
std::vector<Opt> localOpts;

Expand Down
3 changes: 2 additions & 1 deletion src/Cmd/Add.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <string>
#include <string_view>
#include <toml.hpp>
#include <unordered_map>

static int addMain(std::span<const std::string_view> args);

Expand Down Expand Up @@ -166,7 +167,7 @@ addMain(const std::span<const std::string_view> args) {
std::string branch;

// clang-format off
HashMap<
std::unordered_map<
std::string_view,
std::function<std::optional<int>(decltype(args)::iterator&, decltype(args)::iterator)>
>
Expand Down
3 changes: 2 additions & 1 deletion src/Manifest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <variant>
#include <vector>

Expand Down Expand Up @@ -486,7 +487,7 @@ validateDepName(const std::string_view name) {
}
}

HashMap<char, int> charsFreq;
std::unordered_map<char, int> charsFreq;
for (const char c : name) {
++charsFreq[c];
}
Expand Down
4 changes: 0 additions & 4 deletions src/Rustify/Aliases.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <filesystem>
#include <iostream>
#include <string_view>
#include <unordered_map>
#include <unordered_set>

namespace fs = std::filesystem;
Expand All @@ -28,9 +27,6 @@ using f32 = float;
using f64 = double;
// NOLINTEND(readability-identifier-naming)

template <typename K, typename V>
using HashMap = std::unordered_map<K, V>;

template <typename K>
using HashSet = std::unordered_set<K>;

Expand Down
2 changes: 1 addition & 1 deletion srcOld/Resolver/Registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ hash_value(const Registry& r) -> usize {
return seed;
}

using Registries = HashMap<std::string, Registry>;
using Registries = std::unordered_map<std::string, Registry>;

} // namespace poac::core::resolver::registry
4 changes: 2 additions & 2 deletions srcOld/Resolver/Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ struct DuplicateDeps<WithDeps> {

template <typename W>
using UniqDeps = std::conditional_t<
W::value, HashMap<Package, Deps>,
W::value, std::unordered_map<Package, Deps>,
// <name, ver_req>
HashMap<std::string, DependencyInfo>>;
std::unordered_map<std::string, DependencyInfo>>;

} // namespace poac::core::resolver::resolve

Expand Down

0 comments on commit f85bddf

Please sign in to comment.