How to use `std::string` as key of `QHash`?
问题 I want to use a std::string as the key of a QHash : QHash<std::string, QString> m_hash; m_hash.insert("ABC", "DEF"); I implemented the required qHash: inline qHash(const std::string& key, uint seed = 0) { qHash(QByteArray::fromRawData(key.data(), key.length()), seed); } Everything compiles correctly using MSVC, but gcc generates the following error: error: no matching function for call to qHash(const std::__cxx11::basic_string<char>&) How should I resolve this isse? 回答1: Short answer Define