mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-19 03:55:49 +00:00
make enum hashable
This commit is contained in:
parent
539c779606
commit
17c3af4d40
@ -29,6 +29,7 @@ enum class lsMethodId : int {
|
|||||||
CodeLensResolve,
|
CodeLensResolve,
|
||||||
WorkspaceSymbol,
|
WorkspaceSymbol,
|
||||||
};
|
};
|
||||||
|
MAKE_ENUM_HASHABLE(lsMethodId);
|
||||||
|
|
||||||
template<typename TVisitor>
|
template<typename TVisitor>
|
||||||
void Reflect(TVisitor& visitor, lsMethodId& value) {
|
void Reflect(TVisitor& visitor, lsMethodId& value) {
|
||||||
@ -1269,7 +1270,6 @@ struct In_InitializeRequest : public InRequestMessage {
|
|||||||
|
|
||||||
In_InitializeRequest(optional<RequestId> id, Reader& reader)
|
In_InitializeRequest(optional<RequestId> id, Reader& reader)
|
||||||
: InRequestMessage(kMethod, id, reader) {
|
: InRequestMessage(kMethod, id, reader) {
|
||||||
auto type = reader.GetType();
|
|
||||||
Reflect(reader, params);
|
Reflect(reader, params);
|
||||||
std::cerr << "done" << std::endl;
|
std::cerr << "done" << std::endl;
|
||||||
}
|
}
|
||||||
|
9
utils.h
9
utils.h
@ -50,3 +50,12 @@ inline void hash_combine(std::size_t& seed, const T& v, Rest... rest) {
|
|||||||
}\
|
}\
|
||||||
};\
|
};\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAKE_ENUM_HASHABLE(type) \
|
||||||
|
namespace std {\
|
||||||
|
template<> struct hash<type> {\
|
||||||
|
std::size_t operator()(const type &t) const {\
|
||||||
|
return hash<int>()(static_cast<int>(t));\
|
||||||
|
}\
|
||||||
|
};\
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user