Home » U++ Library support » U++ Core » v14609  GetHashValue compilation error 
	
		
		
			| v14609  GetHashValue compilation error [message #54306] | 
			Mon, 22 June 2020 15:23   | 
		 
		
			
				
				
				  | 
					
						  
						Xemuth
						 Messages: 387 Registered: August 2018  Location: France
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		Hello, 
 
After a quick search in forum it seems nobody have ride up this probleme yet. 
In version 14609, function : 
template <class T>
inline hash_t GetHashValue(const T& x)                              { return x.GetHashValue(); }
 
Raise error on compilation on MSVS19 and Clang. 
 
I have made a quick test case : 
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
	ArrayMap<float, int> MyMap ={{8.02f,45},{4.85f,52},{1.75f,12},{9.36f,1},{6.04f,71}};
}
 
 
 
PS: It seems this post is not in is right forum category, I'm sorry, I don't know how could I move it 
		
		
		[Updated on: Mon, 22 June 2020 15:36] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	
		
		
			| Re: v14609  GetHashValue compilation error [message #58776 is a reply to message #54372] | 
			Sun, 28 August 2022 10:01   | 
		 
		
			
				
				
				
					
						  
						jjacksonRIAB
						 Messages: 227 Registered: June 2011 
						
					 | 
					Experienced Member  | 
					 | 
		 
		 
	 | 
 
	
		The problem appears to be in Topt.h where there is no specialization for float (line 476): 
 
//template<> inline hash_t GetHashValue(const float& a)          { double memhash(&a, sizeof(a)); }
 
 
is commented out but it clearly has an error in it. It should be 
 
template<> inline hash_t GetHashValue(const float& a)          { return memhash(&a, sizeof(a)); }
 
 
After making that change it appears to work. 
 
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 02:58:17 CET 2025 
 Total time taken to generate the page: 0.03971 seconds 
 |