Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » v14609 GetHashValue compilation error
v14609 GetHashValue compilation error [message #54306] Mon, 22 June 2020 15:23 Go to next message
Xemuth is currently offline  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 #54372 is a reply to message #54306] Wed, 08 July 2020 10:29 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
For strange reason, the problem don't occure when using a double instead of a float.
Re: v14609 GetHashValue compilation error [message #58776 is a reply to message #54372] Sun, 28 August 2022 10:01 Go to previous message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 219
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.


Previous Topic: Serialize long as uint64 on some platforms
Next Topic: Way to decode websocket frames?
Goto Forum:
  


Current Time: Thu Mar 28 22:04:47 CET 2024

Total time taken to generate the page: 0.01003 seconds