summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b8db3c5)
In order to use Qt types with std::unordered_set (and map), a
compatible hash function needs to be provided. Provide a generic
Hash<T> functor that just uses the qHash() function for the given
type.
This can be used as follows:
std::unordered_set<QString, Hash<QString>> set;
+// STL-compliant hash functor for Qt types
+template<typename T>
+struct Hash
+{
+ uint operator()(const T& t) const
+ {
+ return qHash(t);
+ }
+};
+