I've got a variable size binary data blob that is accessible through a std::byte pointer and a byte size. Is there a way to call std::hash on it? (I can't find any example for this)
I am learning about std::hash and I would like to make a program that hashes a file, even if that file is large. I don't want to load that entire file in memory, I'd rather just hash individual chunks and then somehow hash the hashes.
I understand…
I am creating a Template Cache library in C++-11 where I want to hash the keys. I want to use default std::hash for primitive/pre-defined types like int, std::string, etc. and user-defined hash functions for user-defined types. My code currently…
I have a simple structure:
struct data
{
bool flag;
std::size_t ix;
std::size_t iy;
std::size_t d;
};
I keep all instances of this structure in container, and I need to search it as fast as possible. At the moment I use the std::set with…
I'm not a pro in C++ but somehow I provided a solution while porting my MSVS 2015 C++ code to MinGW 4.9.2 to specialize std::hash class to support all enums. It there's any C++ compiler developers or C++ pro programmers here, can you explain why…
I am receiving the error
"hashmap.hpp:63:14: error: ‘hash’ in namespace ‘std’ does not name a
template type std::hash hash;"
I don't understand why i need to implement my own specialization when I'm passing in type T, which will probably be one…
I've the following problem of which I cannot find a solution.
Of course, it could be that a solution does not exist at all, but I'd like to have a try on SO before to give up.
First of all, a snippet that compiles with no errors:
#include…
I assume that std::hash's specialization for generic pointer types can be used for pointer-to-members, however I am unable to use it as such; instead, my compiler gives me an "incomplete type" error, which I assume means that is' not using the…
hi i am tryng to implement a trait class of std::hash struct but i cannot progress from here:
#include
#include
namespace std {
template<>
struct hash< Test::AckMsgType >
{
…
Why std::Hash has equal result for different strings?
I used msvc2010sp1 and I was suprised when saw this result:
int _tmain(int argc, _TCHAR* argv[])
{
std::string sUniqId ("IndexBuf");
std::stringstream sStream;
sStream << 10;
…
I am trying to compile a project on my mac, which is originally written on linux. It went smoothly on archlinux but has a lot of errors on mac. Especially, I'm very confused with this error message:
In file included from…
Some may have noticed that std::hash does not support tuples. So I added an overload which just seems "nicer" than the solution I saw up till now. Anyone got ideas to further cut down this code? Please note that this is a compiler killer! The only…
Why providing an hash function without specifing any implementation of reference and also without specifying the algorithm of reference ( md5, sha256, etc etc ) ?
Also there are similar features for data structures such as the C++ standard-compliant…
I am writing a code that will find collisions for std::hash and trying to reverse some of hash calculation steps.
There is such a multiplication in std::hash implementation.
size_t hash2 = shift_mix(hash1) * mul;
I know hash2 - from…