mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-08 13:27:57 +00:00
[core] Replace SmallMap
Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
committed by
Konstantin Pastbin
parent
969e1ef2da
commit
882dccb87d
@@ -20,6 +20,7 @@ NewFeatureCategories::NewFeatureCategories(editor::EditorConfig const & config)
|
||||
}
|
||||
m_types.emplace_back(clType);
|
||||
}
|
||||
m_addedLangs.reserve(CategoriesHolder::kLocaleMapping.size() + 1);
|
||||
}
|
||||
|
||||
NewFeatureCategories::NewFeatureCategories(NewFeatureCategories && other) noexcept
|
||||
@@ -37,14 +38,14 @@ void NewFeatureCategories::AddLanguage(std::string lang)
|
||||
lang = "en";
|
||||
langCode = CategoriesHolder::kEnglishCode;
|
||||
}
|
||||
if (m_addedLangs.Contains(langCode))
|
||||
if (m_addedLangs.contains(langCode))
|
||||
return;
|
||||
|
||||
auto const & c = classif();
|
||||
for (auto const & type : m_types)
|
||||
m_index.AddCategoryByTypeAndLang(c.GetTypeByReadableObjectName(type), langCode);
|
||||
|
||||
m_addedLangs.Insert(langCode);
|
||||
m_addedLangs.insert(langCode);
|
||||
}
|
||||
|
||||
NewFeatureCategories::TypeNames NewFeatureCategories::Search(std::string const & query) const
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
#include "indexer/categories_index.hpp"
|
||||
|
||||
#include "base/macros.hpp"
|
||||
#include "base/small_set.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
namespace osm
|
||||
{
|
||||
// This class holds an index of categories that can be set for a newly added feature.
|
||||
@@ -43,7 +44,7 @@ public:
|
||||
TypeNames const & GetAllCreatableTypeNames() const { return m_types; }
|
||||
|
||||
private:
|
||||
using Langs = base::SmallSet<CategoriesHolder::kLocaleMapping.size() + 1>;
|
||||
using Langs = ankerl::unordered_dense::set<int8_t>;
|
||||
|
||||
indexer::CategoriesIndex m_index;
|
||||
Langs m_addedLangs;
|
||||
|
||||
Reference in New Issue
Block a user