[core] Switch to ankerl::unordered_dense

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-11-24 17:34:56 +00:00
committed by Konstantin Pastbin
parent a60efa9b43
commit 969e1ef2da
281 changed files with 4381 additions and 1451 deletions

View File

@@ -6,7 +6,8 @@
#include <QtWidgets/QDialog>
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
class QTreeWidget;
class QTreeWidgetItem;
@@ -43,8 +44,8 @@ private:
QTreeWidget * m_tree;
Framework & m_framework;
std::unordered_map<QTreeWidgetItem *, kml::MarkGroupId> m_categories;
std::unordered_map<QTreeWidgetItem *, kml::MarkId> m_bookmarks;
std::unordered_map<QTreeWidgetItem *, kml::TrackId> m_tracks;
ankerl::unordered_dense::map<QTreeWidgetItem *, kml::MarkGroupId> m_categories;
ankerl::unordered_dense::map<QTreeWidgetItem *, kml::MarkId> m_bookmarks;
ankerl::unordered_dense::map<QTreeWidgetItem *, kml::TrackId> m_tracks;
};
} // namespace qt

View File

@@ -11,9 +11,10 @@
#include <functional>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include "3party/ankerl/unordered_dense.h"
#include <QtCore/QDir>
namespace
@@ -87,9 +88,9 @@ std::string trim(std::string && s)
namespace build_style
{
std::unordered_map<std::string, int> GetSkinSizes(QString const & file)
ankerl::unordered_dense::map<std::string, int> GetSkinSizes(QString const & file)
{
std::unordered_map<std::string, int> skinSizes;
ankerl::unordered_dense::map<std::string, int> skinSizes;
for (SkinType s : g_skinTypes)
skinSizes.insert(std::make_pair(SkinSuffix(s), SkinSize(s)));

View File

@@ -119,9 +119,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent, Framework & framework)
// Create a vector of pairs (name, index) and sort by name
std::vector<std::pair<std::string, size_t>> languageNameIndexPairs;
for (size_t i = 0; i < supportedLanguages.size(); ++i)
{
languageNameIndexPairs.emplace_back(std::string(supportedLanguages[i].m_name), i);
}
std::sort(languageNameIndexPairs.begin(), languageNameIndexPairs.end(),
[](auto const & a, auto const & b) { return a.first < b.first; });

View File

@@ -10,7 +10,8 @@
#include "geometry/point2d.hpp"
#include <string>
#include <unordered_set>
#include "3party/ankerl/unordered_dense.h"
namespace qt
{
@@ -28,6 +29,6 @@ private:
static std::string GetId(routing::turns::TurnItem const & turn);
// Turn ids for rendering on the map and erasing by drape.
std::unordered_set<std::string> m_turnIds;
ankerl::unordered_dense::set<std::string> m_turnIds;
};
} // namespace qt

View File

@@ -9,10 +9,11 @@
#include <cstdint>
#include <optional>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
#include <QtWidgets/QApplication>
#include <QtWidgets/QDialog>
@@ -49,7 +50,7 @@ private slots:
private:
// CountryId to its ranking position and matched string (assuming no duplicates).
using Filter = std::unordered_map<storage::CountryId, std::pair<size_t, std::string>>;
using Filter = ankerl::unordered_dense::map<storage::CountryId, std::pair<size_t, std::string>>;
void RefillTree();
void StartSearchInDownloader();