[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
parent 03132c6877
commit ef6522ed28
282 changed files with 4386 additions and 1456 deletions

View File

@@ -32,7 +32,8 @@
#include <chrono>
#include <limits>
#include <sstream>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace
{
@@ -2671,8 +2672,8 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool
ResetIds(fileData);
}
std::unordered_map<kml::CompilationId, BookmarkCategory *> compilations;
std::unordered_set<std::string> compilationNames;
ankerl::unordered_dense::map<kml::CompilationId, BookmarkCategory *> compilations;
ankerl::unordered_dense::set<std::string> compilationNames;
for (auto & compilation : fileData.m_compilationsData)
{
SetUniqueName(compilation, [&compilationNames](auto const & name) { return compilationNames.count(name) == 0; });
@@ -3206,7 +3207,7 @@ void BookmarkManager::MarksChangesTracker::InferVisibility(BookmarkCategory * co
kml::CategoryData const & categoryData = group->GetCategoryData();
if (categoryData.m_compilationIds.empty())
return;
std::unordered_set<kml::MarkGroupId> visibility;
ankerl::unordered_dense::set<kml::MarkGroupId> visibility;
visibility.reserve(categoryData.m_compilationIds.size());
for (kml::MarkGroupId const compilationId : categoryData.m_compilationIds)
{

View File

@@ -3130,8 +3130,8 @@ void Framework::CreateNote(osm::MapObject const & mapObject, osm::Editor::NotePr
latLon = mapObject.GetLatLon();
}
osm::Editor::Instance().CreateNote(latLon, mapObject.GetID(), mapObject.GetTypes(),
mapObject.GetDefaultName(), type, note);
osm::Editor::Instance().CreateNote(latLon, mapObject.GetID(), mapObject.GetTypes(), mapObject.GetDefaultName(), type,
note);
if (type == osm::Editor::NoteProblemType::PlaceDoesNotExist)
DeactivateMapSelection();
}

View File

@@ -2,13 +2,13 @@
#include "base/assert.hpp"
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
using namespace power_management;
namespace
{
std::unordered_map<Scheme, FacilitiesState> const kSchemeToState = {
ankerl::unordered_dense::map<Scheme, FacilitiesState> const kSchemeToState = {
{Scheme::Normal,
{{
/* Buildings3d */ true,
@@ -47,7 +47,7 @@ std::unordered_map<Scheme, FacilitiesState> const kSchemeToState = {
}}},
};
std::unordered_map<AutoScheme, FacilitiesState> const kAutoSchemeToState = {
ankerl::unordered_dense::map<AutoScheme, FacilitiesState> const kAutoSchemeToState = {
{AutoScheme::Normal,
{{
/* Buildings3d */ true,

View File

@@ -349,16 +349,16 @@ void RoutePointsLayout::SetFollowingMode(bool enabled)
void RoutePointsLayout::RemovePassedPoints()
{
// Prevent recalculation of markIds at every iteration, since we are removing elements
auto markIds = m_manager.GetUserMarkIds(UserMark::Type::ROUTING);
for (auto markId : markIds) {
auto * mark = m_editSession.GetMarkForEdit<RouteMarkPoint>(markId);
if (mark && mark->IsPassed() && mark->GetRoutePointType() == RouteMarkType::Intermediate)
m_editSession.DeleteUserMark(mark->GetId());
}
// Prevent recalculation of markIds at every iteration, since we are removing elements
auto markIds = m_manager.GetUserMarkIds(UserMark::Type::ROUTING);
for (auto markId : markIds)
{
auto * mark = m_editSession.GetMarkForEdit<RouteMarkPoint>(markId);
if (mark && mark->IsPassed() && mark->GetRoutePointType() == RouteMarkType::Intermediate)
m_editSession.DeleteUserMark(mark->GetId());
}
}
RouteMarkPoint const * RoutePointsLayout::GetRoutePoint(RouteMarkType type, size_t intermediateIndex) const
{
for (auto markId : m_manager.GetUserMarkIds(UserMark::Type::ROUTING))

View File

@@ -98,6 +98,7 @@ public:
void PassRoutePoint(RouteMarkType type, size_t intermediateIndex = 0);
void SetFollowingMode(bool enabled);
void RemovePassedPoints();
private:
using TRoutePointCallback = std::function<void(RouteMarkPoint * mark)>;
void ForEachIntermediatePoint(TRoutePointCallback const & fn);

View File

@@ -21,6 +21,8 @@
#include <string>
#include <type_traits>
#include "3party/ankerl/unordered_dense.h"
using namespace search;
using namespace std;
@@ -323,7 +325,7 @@ void SearchAPI::EnableIndexingOfBookmarkGroup(kml::MarkGroupId const & groupId,
m_engine.EnableIndexingOfBookmarkGroup(KmlGroupIdToSearchGroupId(groupId), enable);
}
unordered_set<kml::MarkGroupId> const & SearchAPI::GetIndexableGroups() const
ankerl::unordered_dense::set<kml::MarkGroupId> const & SearchAPI::GetIndexableGroups() const
{
return m_indexableGroups;
}

View File

@@ -20,9 +20,10 @@
#include <memory>
#include <optional>
#include <string>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
class DataSource;
namespace search
@@ -121,7 +122,7 @@ public:
// This method must be used to enable or disable indexing all current and future
// bookmarks belonging to |groupId|.
void EnableIndexingOfBookmarkGroup(kml::MarkGroupId const & groupId, bool enable);
std::unordered_set<kml::MarkGroupId> const & GetIndexableGroups() const;
ankerl::unordered_dense::set<kml::MarkGroupId> const & GetIndexableGroups() const;
// Returns the bookmarks search to its default, pre-launch state.
// This includes dropping all bookmark data for created bookmarks (efficiently
@@ -175,5 +176,5 @@ private:
// Same as the one in bookmarks::Processor. Duplicated here because
// it is easier than obtaining the information about a group asynchronously
// from |m_engine|.
std::unordered_set<kml::MarkGroupId> m_indexableGroups;
ankerl::unordered_dense::set<kml::MarkGroupId> m_indexableGroups;
};