Skip to content

Hash of std::vector<dna4> is linear, should be constant for unordered_maps. #1122

Description

@h-2

Interesting: https://en.cppreference.com/w/cpp/utility/hash says

The actual hash functions are implementation-dependent and are not required to fulfill any other quality criteria except those specified above. Notably, some implementations use trivial (identity) hash functions which map an integer to itself. In other words, these hash functions are designed to work with unordered associative containers, but not as cryptographic hashes, for example.

But, when using unorderd_map it says in https://en.cppreference.com/w/cpp/container/unordered_map/hash_function:

Complexity

Constant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions