Skip to content

Commit

Permalink
Support stdlibs missing "Heterogeneous comparison lookup in unordered…
Browse files Browse the repository at this point in the history
… associative containers"
  • Loading branch information
jhasse committed Oct 18, 2024
1 parent 7d52c1c commit 1e4040c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/TextureCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
namespace jngl {

std::shared_ptr<Texture> 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;
}
Expand All @@ -20,7 +24,11 @@ void TextureCache::insert(std::string_view filename, std::shared_ptr<Texture> 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);
}
Expand Down

0 comments on commit 1e4040c

Please sign in to comment.