mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Use template specialisation
This commit is contained in:
		
							parent
							
								
									95e80809a5
								
							
						
					
					
						commit
						5473e597bf
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
					@ -135,10 +135,10 @@ struct SigPool
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <typename T, class Compare = std::less<T>>
 | 
					template <typename T, class Compare=void>
 | 
				
			||||||
struct SigSet
 | 
					struct SigSet
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	static_assert(!std::is_pointer<T>::value || !std::is_same<Compare, std::less<T>>::value, "Explicit `Compare' class required for SigSet with pointer-type values!");
 | 
						static_assert(!std::is_same<Compare,void>::value, "Default value for `Compare' class not found for SigSet<T>. Please specify.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct bitDef_t : public std::pair<RTLIL::Wire*, int> {
 | 
						struct bitDef_t : public std::pair<RTLIL::Wire*, int> {
 | 
				
			||||||
		bitDef_t() : std::pair<RTLIL::Wire*, int>(NULL, 0) { }
 | 
							bitDef_t() : std::pair<RTLIL::Wire*, int>(NULL, 0) { }
 | 
				
			||||||
| 
						 | 
					@ -222,6 +222,13 @@ struct SigSet
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<typename T>
 | 
				
			||||||
 | 
					class SigSet<T, typename std::enable_if<!std::is_pointer<T>::value>::type> : public SigSet<T, std::less<T>> {};
 | 
				
			||||||
 | 
					template<typename T>
 | 
				
			||||||
 | 
					using sort_by_name_id_guard = typename std::enable_if<std::is_same<T,RTLIL::Cell*>::value>::type;
 | 
				
			||||||
 | 
					template<typename T>
 | 
				
			||||||
 | 
					class SigSet<T, sort_by_name_id_guard<T>> : public SigSet<T, RTLIL::sort_by_name_id<typename std::remove_pointer<T>::type>> {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct SigMap
 | 
					struct SigMap
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	mfp<SigBit> database;
 | 
						mfp<SigBit> database;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue