This repository was archived by the owner on Aug 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 44
55#include < exception>
66#include < iostream>
7+ #include < functional>
78#include " serializable.hpp"
89#include " mirai/exported.h"
910
@@ -29,13 +30,19 @@ namespace Cyan
2930 {
3031 return !operator ==(a);
3132 }
33+
34+ bool operator <(const UID_t& a) const
35+ {
36+ return data_ < a.data_ ;
37+ }
38+
3239 virtual ~UID_t () = default ;
3340 protected:
3441 explicit UID_t (int64_t id) : data_(id) {}
3542 virtual void __avoiding_object_slicing () const = 0;
3643 int64_t data_;
3744 };
38-
45+
3946 // 储存 QQ 号码的类型
4047 class QQ_t : public UID_t
4148 {
@@ -145,4 +152,26 @@ namespace Cyan
145152
146153}
147154
155+ namespace std
156+ {
157+ template <> struct hash <Cyan::UID_t>
158+ {
159+ size_t operator () (const Cyan::UID_t& t) const {
160+ return size_t (t.ToInt64 ());
161+ }
162+ };
163+ template <> struct hash <Cyan::GID_t>
164+ {
165+ size_t operator () (const Cyan::GID_t& t) const {
166+ return size_t (t.ToInt64 ());
167+ }
168+ };
169+ template <> struct hash <Cyan::QQ_t>
170+ {
171+ size_t operator () (const Cyan::QQ_t& t) const {
172+ return size_t (t.ToInt64 ());
173+ }
174+ };
175+ }
176+
148177#endif // !mirai_cpp_defs_qq_types_hpp_H_
You can’t perform that action at this time.
0 commit comments