Sqlite: Add hash operator to BasicId

Because QHash is supporting std::hash we don't need to add a qHash
function. That is saving us an include to qhashfunction.h too.

Change-Id: I457051c828d25771028f3f28bf19ecb65c51edd1
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Marco Bubke
2023-09-06 12:24:20 +02:00
parent aaf7fba0c3
commit 99cabee246

View File

@@ -78,3 +78,14 @@ auto toIntegers(const Container &container)
} }
} // namespace Sqlite } // namespace Sqlite
namespace std {
template<auto Type, typename InternalIntegerType>
struct hash<Sqlite::BasicId<Type, InternalIntegerType>>
{
auto operator()(const Sqlite::BasicId<Type, InternalIntegerType> &id) const
{
return std::hash<InternalIntegerType>(id.internalId());
}
};
} // namespace std