Common: Remove fallback for missing heterogeneous lookup

Minspec has this now, and I don't need to worry about Debian 11 anymore.
This commit is contained in:
Stenzek
2025-12-31 18:10:27 +10:00
parent 0a9bf5aa00
commit 14625af98e
9 changed files with 15 additions and 36 deletions

View File

@@ -55,7 +55,6 @@ using StringMultiMap = std::multimap<std::string, ValueType, detail::transparent
using StringSet = std::set<std::string, detail::transparent_string_less>;
using StringMultiSet = std::multiset<std::string, detail::transparent_string_less>;
#if defined(__cpp_lib_generic_unordered_lookup) && __cpp_lib_generic_unordered_lookup >= 201811L
template<typename ValueType>
using UnorderedStringMap =
std::unordered_map<std::string, ValueType, detail::transparent_string_hash, detail::transparent_string_equal>;
@@ -66,23 +65,3 @@ using UnorderedStringSet =
std::unordered_set<std::string, detail::transparent_string_hash, detail::transparent_string_equal>;
using UnorderedStringMultiSet =
std::unordered_multiset<std::string, detail::transparent_string_hash, detail::transparent_string_equal>;
template<typename ValueType>
using PreferUnorderedStringMap = UnorderedStringMap<ValueType>;
template<typename ValueType>
using PreferUnorderedStringMultimap = UnorderedStringMultimap<ValueType>;
using PreferUnorderedStringSet = UnorderedStringSet;
using PreferUnorderedStringMultiSet = UnorderedStringMultiSet;
#else
#pragma message "__cpp_lib_generic_unordered_lookup is missing, performance will be slower."
// GCC 10 doesn't support generic_unordered_lookup...
template<typename ValueType>
using PreferUnorderedStringMap = StringMap<ValueType>;
template<typename ValueType>
using PreferUnorderedStringMultimap = StringMultiMap<ValueType>;
using PreferUnorderedStringSet = StringSet;
using PreferUnorderedStringMultiSet = StringMultiSet;
#endif

View File

@@ -52,8 +52,8 @@ public:
using SettingsInterface::GetUIntValue;
private:
using KeyMap = PreferUnorderedStringMultimap<std::string>;
using SectionMap = PreferUnorderedStringMap<KeyMap>;
using KeyMap = UnorderedStringMultimap<std::string>;
using SectionMap = UnorderedStringMap<KeyMap>;
void SetValue(const char* section, const char* key, std::string value);

View File

@@ -75,5 +75,5 @@ public:
private:
std::vector<char> m_buffer;
PreferUnorderedStringMap<Offset> m_string_map;
UnorderedStringMap<Offset> m_string_map;
};

View File

@@ -55,7 +55,7 @@ static bool SaveToCache();
static bool LoadGameDBYaml();
static bool ParseYamlEntry(Entry* entry, const ryml::ConstNodeRef& value);
static bool ParseYamlDiscSetEntry(DiscSetEntry* entry, const ryml::ConstNodeRef& value);
static bool ParseYamlCodes(PreferUnorderedStringMap<std::string_view>& lookup, const ryml::ConstNodeRef& value,
static bool ParseYamlCodes(UnorderedStringMap<std::string_view>& lookup, const ryml::ConstNodeRef& value,
std::string_view serial);
static void BindDiscSetsToEntries();
static bool LoadTrackHashes();
@@ -179,7 +179,7 @@ struct State
std::vector<GameDatabase::Entry> entries;
std::vector<GameDatabase::DiscSetEntry> disc_sets;
PreferUnorderedStringMap<u32> code_lookup;
UnorderedStringMap<u32> code_lookup;
TrackHashesMap track_hashes_map;
@@ -1342,7 +1342,7 @@ bool GameDatabase::LoadGameDBYaml()
return false;
}
PreferUnorderedStringMap<std::string_view> code_lookup;
UnorderedStringMap<std::string_view> code_lookup;
{
const ryml::Tree tree = ryml::parse_in_place(
to_csubstr(GAMEDB_YAML_FILENAME), c4::substr(reinterpret_cast<char*>(gamedb_data->data()), gamedb_data->size()));
@@ -1696,7 +1696,7 @@ void GameDatabase::BindDiscSetsToEntries()
}
}
bool GameDatabase::ParseYamlCodes(PreferUnorderedStringMap<std::string_view>& lookup, const ryml::ConstNodeRef& value,
bool GameDatabase::ParseYamlCodes(UnorderedStringMap<std::string_view>& lookup, const ryml::ConstNodeRef& value,
std::string_view serial)
{
const ryml::ConstNodeRef& codes = value.find_child(to_csubstr("codes"));

View File

@@ -87,8 +87,8 @@ struct MemcardTimestampCacheEntry
} // namespace
using CacheMap = PreferUnorderedStringMap<Entry>;
using PlayedTimeMap = PreferUnorderedStringMap<PlayedTimeEntry>;
using CacheMap = UnorderedStringMap<Entry>;
using PlayedTimeMap = UnorderedStringMap<PlayedTimeEntry>;
static_assert(std::is_same_v<decltype(Entry::hash), GameHash>);

View File

@@ -246,8 +246,8 @@ struct DumpedTextureKeyHash
} // namespace
using HashCache = std::unordered_map<HashCacheKey, HashCacheEntry, HashCacheKeyHash>;
using ReplacementImageCache = PreferUnorderedStringMap<TextureReplacementImage>;
using GPUReplacementImageCache = PreferUnorderedStringMap<std::pair<std::unique_ptr<GPUTexture>, u32>>;
using ReplacementImageCache = UnorderedStringMap<TextureReplacementImage>;
using GPUReplacementImageCache = UnorderedStringMap<std::pair<std::unique_ptr<GPUTexture>, u32>>;
using VRAMReplacementMap = std::unordered_map<VRAMReplacementName, std::string, VRAMReplacementNameHash>;
using TextureReplacementMap =

View File

@@ -179,7 +179,7 @@ private:
QPixmap m_has_achievements_pixmap;
QPixmap m_mastered_achievements_pixmap;
mutable PreferUnorderedStringMap<QPixmap> m_flag_pixmap_cache;
mutable UnorderedStringMap<QPixmap> m_flag_pixmap_cache;
mutable LRUCache<std::string, QPixmap> m_icon_pixmap_cache;

View File

@@ -89,7 +89,7 @@ public:
private:
static bool GetLine(const std::string_view& contents, std::string_view* line, size_t& offset);
PreferUnorderedStringMap<std::string> m_options;
UnorderedStringMap<std::string> m_options;
};
class SlangShaderPreprocessor

View File

@@ -19,8 +19,8 @@ static std::pair<const char*, u32> LookupTranslationString(std::string_view cont
std::string_view disambiguation);
static constexpr u32 TRANSLATION_STRING_CACHE_SIZE = 4 * 1024 * 1024;
using TranslationStringMap = PreferUnorderedStringMap<std::pair<u32, u32>>;
using TranslationStringContextMap = PreferUnorderedStringMap<TranslationStringMap>;
using TranslationStringMap = UnorderedStringMap<std::pair<u32, u32>>;
using TranslationStringContextMap = UnorderedStringMap<TranslationStringMap>;
struct TranslationLocals
{