mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-30 19:22:31 +00:00 
			
		
		
		
	Added hashlib support for std::tuple<>
This commit is contained in:
		
							parent
							
								
									f7fb21f185
								
							
						
					
					
						commit
						aae5f2ca08
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		|  | @ -92,6 +92,21 @@ template<typename P, typename Q> struct hash_ops<std::pair<P, Q>> { | |||
| 	} | ||||
| }; | ||||
| 
 | ||||
| template<typename... T> struct hash_ops<std::tuple<T...>> { | ||||
| 	static inline bool cmp(std::tuple<T...> a, std::tuple<T...> b) { | ||||
| 		return a == b; | ||||
| 	} | ||||
| 	template<size_t I = 0> | ||||
| 	static inline typename std::enable_if<I == sizeof...(T), unsigned int>::type hash(std::tuple<T...>) { | ||||
| 		return mkhash_init; | ||||
| 	} | ||||
| 	template<size_t I = 0> | ||||
| 	static inline typename std::enable_if<I != sizeof...(T), unsigned int>::type hash(std::tuple<T...> a) { | ||||
| 		hash_ops<typename std::tuple_element<I, std::tuple<T...>>::type> element_ops; | ||||
| 		return mkhash(hash<I+1>(a), element_ops.hash(std::get<I>(a))); | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
| template<typename T> struct hash_ops<std::vector<T>> { | ||||
| 	static inline bool cmp(std::vector<T> a, std::vector<T> b) { | ||||
| 		return a == b; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue