Home » Community » Newbie corner » Compile time hash macro
Compile time hash macro [message #56341] |
Tue, 23 February 2021 17:55  |
 |
Xemuth
Messages: 316 Registered: August 2018 Location: France
|
Senior Member |
|
|
Hello U++ !
Is there a way in U++ to do hashing of String during compilation ?
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
Cout() << GetHashValue ("Hello") << EOL; //Runtime hashing
Cout() << HASH64("Hello") << EOL; //Compile time hashing
//Both value printed should be identique
}
my github : https://github.com/Xemuth
|
|
|
Re: Compile time hash macro [message #56342 is a reply to message #56341] |
Tue, 23 February 2021 18:07   |
Novo
Messages: 1162 Registered: December 2006
|
Senior Contributor |
|
|
Not right now. But you can try to reimplement function hash_t memhash(const void *ptr, size_t count) as constexpr.
If you do that it will be possible to call it at compile time.
Regards,
Novo
|
|
|
|
|
Goto Forum:
Current Time: Fri Mar 05 14:54:07 CET 2021
Total time taken to generate the page: 0.01277 seconds
|