Merge pull request #324 from eoan-ermine/hash

Implement std::hash for boost::fibers::context::id
This commit is contained in:
Oliver Kowalke
2024-12-26 08:21:59 +01:00
committed by GitHub
2 changed files with 22 additions and 0 deletions
+12
View File
@@ -174,6 +174,7 @@ private:
public:
class id {
private:
friend std::hash<id>;
context * impl_{ nullptr };
public:
@@ -520,6 +521,17 @@ static intrusive_ptr< context > make_worker_context( launch policy,
}}
// std::hash specialization
namespace std {
template <>
struct hash< ::boost::fibers::context::id > {
std::size_t
operator() ( ::boost::fibers::context::id const& id ) const noexcept;
};
}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
+10
View File
@@ -434,6 +434,16 @@ context::attach( context * ctx) noexcept {
}}
namespace std {
std::size_t
hash< ::boost::fibers::context::id >::operator() ( ::boost::fibers::context::id const& id ) const noexcept {
return reinterpret_cast<std::size_t>(id.impl_);
}
}
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif