[hash] Adjust hash for shared_ptr, implement it for std::hash
diff --git a/src/hb-cplusplus.hh b/src/hb-cplusplus.hh index 9bda38c..42c7d56 100644 --- a/src/hb-cplusplus.hh +++ b/src/hb-cplusplus.hh
@@ -88,8 +88,6 @@ template<typename T> struct is_shared_ptr : std::false_type {}; template<typename T> struct is_shared_ptr<shared_ptr<T>> : std::true_type {}; -// TODO Implement hash<> and atomic<> - template <typename T, T * (*_get_empty) (void), T * (*_reference) (T *), @@ -135,6 +133,19 @@ } // namespace hb +template<typename T> +struct std::hash<hb::shared_ptr<T>> +{ + std::size_t operator()(const hb::shared_ptr<T>& v) const noexcept + { + std::size_t h = std::hash<decltype (v.get ())>{}(v.get ()); + return h; + } +}; + +// TODO Implement atomic<> + + #endif /* __cplusplus */ #endif /* HB_CPLUSPLUS_HH */