I am trying to define a type that's an unordered_set
over pair
s of unsigned int
:
typedef std::pair<unsigned int, unsigned int> Loc;
auto HashLoc = [](const Loc &l) {
return l.first << 16 ^ l.second;
};
typedef std::unordered_set<Loc, decltype(HashLoc)> LocSet;
This was based on the accepted answer to creating unordered_set with lambda.
I'm getting an error, error: call to implicitly-deleted default constructor of 'LocSet'
, when I try to actually declare an object of that type. Based on the extra detail the compiler gives, it looks like it's trying to call a deleted default constructor for the lambda.
Interestingly, the answer linked to above suggests that VS2013 does just this and it's a bug, but gcc and clang are supposed to work. But, I'm using clang (version 8.0.1). Is this expected behavior, and if so, what's the proper way to do what I'm trying to do?