-
-
Save strangeglyph/35dd47b6b9a02d407e482672b855e91d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <memory> | |
#include <unordered_map> | |
/// -------------- | |
class ImplBase; | |
class Class { | |
std::unique_ptr<ImplBase> impl; | |
public: | |
size_t foo() const; | |
bool operator ==(const Class &other); | |
}; | |
namespace std { | |
template <> | |
struct hash<Class> { | |
size_t operator ()(const Class &cls) const { | |
return cls.foo(); | |
} | |
}; | |
} | |
using MyMap = std::unordered_map<Class, size_t>; | |
void foo() { | |
MyMap map = MyMap(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "a.h" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment