aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/sqlite
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2023-09-06 12:24:20 +0200
committerMarco Bubke <marco.bubke@qt.io>2023-09-06 11:32:40 +0000
commit99cabee246338da7b2d6fc959cce16943d4149e9 (patch)
treefd2f86a126c240a38ff48b8788ecd526d20dec53 /src/libs/sqlite
parentaaf7fba0c3bdfafff659cd8ac9adbdf17586b420 (diff)
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>
Diffstat (limited to 'src/libs/sqlite')
-rw-r--r--src/libs/sqlite/sqliteids.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libs/sqlite/sqliteids.h b/src/libs/sqlite/sqliteids.h
index 6296f84718..2309bd58e5 100644
--- a/src/libs/sqlite/sqliteids.h
+++ b/src/libs/sqlite/sqliteids.h
@@ -78,3 +78,14 @@ auto toIntegers(const Container &container)
}
} // 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