Overte C++ Documentation
UUIDHasher.h
1 //
2 // UUIDHasher.h
3 // libraries/networking/src
4 //
5 // Created by Stephen Birarda on 2014-11-05.
6 // Copyright 2014 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_UUIDHasher_h
13 #define hifi_UUIDHasher_h
14 
15 #include <QUuid>
16 
17 // uses the same hashing performed by Qt
18 // https://qt.gitorious.org/qt/qtbase/source/73ef64fb5fabb60101a3cac6e43f0c5bb2298000:src/corelib/plugin/quuid.cpp
19 
20 class UUIDHasher {
21 public:
22  size_t operator()(const QUuid& uuid) const { return qHash(uuid); }
23 };
24 
25 template <>
26 struct std::hash<QUuid> {
27  size_t operator()(const QUuid& uuid) const { return qHash(uuid); }
28 };
29 
30 #endif // hifi_UUIDHasher_h