martinus / robin-hood-hashing

Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
https://gitter.im/martinus/robin-hood-hashing
MIT License
1.5k stars 142 forks source link

ADL + unscoped call to free = ambiguous overload #90

Closed Ryan-rsm-McKenzie closed 3 years ago

Ryan-rsm-McKenzie commented 3 years ago

The unscoped call to free here can find unwanted overloads of the function and throw compilation errors. Here's an example:

#include <cstdlib>

#include "robin_hood.h"

namespace foo
{
    void free(void* ptr) { std::free(ptr); }
    enum bar {};
}

int main()
{
    robin_hood::unordered_set<foo::bar> error;
    return 0;
}

Resolving the scope like ::free should solve it.

martinus commented 3 years ago

Thanks for finding this, should be fixed in the latest commits (no release yet though)