Commit af4a8d80 authored by Kirill Smelkov's avatar Kirill Smelkov

libgolang: Provide std::hash<refptr>

So that refptr<T> could be used as keys in e.g. dict (unordered_map) or
set (unordered_set). set<refptr> will soon be used by C version of
context package.
parent 66e1e756
......@@ -605,6 +605,20 @@ public:
} // golang::
// std::hash<refptr>
namespace std {
template<typename T> struct hash<golang::refptr<T>> {
std::size_t operator()(const golang::refptr<T>& p) const noexcept {
return hash<T*>()(p._ptr());
}
};
} // std::
#endif // __cplusplus
#endif // _NXD_LIBGOLANG_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment