From 1e4040c377391bf2e4e51708ce4b8ac5436753f8 Mon Sep 17 00:00:00 2001 From: Jan Niklas Hasse Date: Fri, 18 Oct 2024 18:48:11 +0200 Subject: [PATCH] Support stdlibs missing "Heterogeneous comparison lookup in unordered associative containers" --- src/TextureCache.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/TextureCache.cpp b/src/TextureCache.cpp index e7f0e5d9..b001721e 100644 --- a/src/TextureCache.cpp +++ b/src/TextureCache.cpp @@ -7,7 +7,11 @@ namespace jngl { std::shared_ptr TextureCache::get(std::string_view filename) { +#if __cpp_lib_generic_unordered_lookup auto it = textures.find(filename); +#else + auto it = textures.find(std::string(filename)); +#endif if (it == textures.end()) { return nullptr; } @@ -20,7 +24,11 @@ void TextureCache::insert(std::string_view filename, std::shared_ptr te } void TextureCache::remove(std::string_view filename) { +#if __cpp_lib_generic_unordered_lookup auto it = textures.find(filename); +#else + auto it = textures.find(std::string(filename)); +#endif if (it != textures.end()) { textures.erase(it); }