mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +00:00 
			
		
		
		
	Work around libstdc++'s lack of support for std::hash on enums
This commit is contained in:
		
							parent
							
								
									83e6e4ffec
								
							
						
					
					
						commit
						666f6deb47
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -16,6 +16,21 @@
 | 
			
		|||
#include "core/hle/kernel/session.h"
 | 
			
		||||
#include "core/hle/result.h"
 | 
			
		||||
 | 
			
		||||
// Specializes std::hash for ArchiveIdCode, so that we can use it in std::unordered_map.
 | 
			
		||||
// Workaroung for libstdc++ bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60970
 | 
			
		||||
namespace std {
 | 
			
		||||
    template <>
 | 
			
		||||
    struct hash<Service::FS::ArchiveIdCode> {
 | 
			
		||||
        typedef Service::FS::ArchiveIdCode argument_type;
 | 
			
		||||
        typedef std::size_t result_type;
 | 
			
		||||
 | 
			
		||||
        result_type operator()(const argument_type& id_code) const {
 | 
			
		||||
            typedef std::underlying_type<argument_type>::type Type;
 | 
			
		||||
            return std::hash<Type>()(static_cast<Type>(id_code));
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace Service {
 | 
			
		||||
namespace FS {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue