diff options
| author | 2014-12-15 22:06:23 -0200 | |
|---|---|---|
| committer | 2014-12-16 01:09:21 -0200 | |
| commit | 666f6deb47774ad101710f619fb9ac66514b3012 (patch) | |
| tree | 3e68c1a91b9cc8f7a67ec6d5b729303f24fcd3af | |
| parent | FS.Archive: Clean up treatment of archives and their handles (diff) | |
| download | yuzu-666f6deb47774ad101710f619fb9ac66514b3012.tar.gz yuzu-666f6deb47774ad101710f619fb9ac66514b3012.tar.xz yuzu-666f6deb47774ad101710f619fb9ac66514b3012.zip | |
Work around libstdc++'s lack of support for std::hash on enums
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/fs/archive.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index a4ee7a156..caf82d556 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp | |||
| @@ -16,6 +16,21 @@ | |||
| 16 | #include "core/hle/kernel/session.h" | 16 | #include "core/hle/kernel/session.h" |
| 17 | #include "core/hle/result.h" | 17 | #include "core/hle/result.h" |
| 18 | 18 | ||
| 19 | // Specializes std::hash for ArchiveIdCode, so that we can use it in std::unordered_map. | ||
| 20 | // Workaroung for libstdc++ bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60970 | ||
| 21 | namespace std { | ||
| 22 | template <> | ||
| 23 | struct hash<Service::FS::ArchiveIdCode> { | ||
| 24 | typedef Service::FS::ArchiveIdCode argument_type; | ||
| 25 | typedef std::size_t result_type; | ||
| 26 | |||
| 27 | result_type operator()(const argument_type& id_code) const { | ||
| 28 | typedef std::underlying_type<argument_type>::type Type; | ||
| 29 | return std::hash<Type>()(static_cast<Type>(id_code)); | ||
| 30 | } | ||
| 31 | }; | ||
| 32 | } | ||
| 33 | |||
| 19 | namespace Service { | 34 | namespace Service { |
| 20 | namespace FS { | 35 | namespace FS { |
| 21 | 36 | ||