Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions olp-cpp-sdk-core/include/olp/core/client/CancellationContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class CORE_API CancellationContext {
private:
/// A helper for unordered containers.
friend struct CancellationContextHash;
friend struct CancellationContextEquality;

/**
* @brief An implementation used to shared the `CancellationContext` instance.
Expand Down Expand Up @@ -126,6 +127,22 @@ struct CORE_API CancellationContextHash {
size_t operator()(const CancellationContext& context) const;
};

/**
* @brief A helper for unordered containers for equality comparison
*/
struct CORE_API CancellationContextEquality {
/**
* @brief Checks equality for two `CancellationContext` instances.
*
* @param lhs The first `CancellationContext` instance.
* @param rhs The second `CancellationContext` instance.
*
* @return True if both refer to the same implementation; false otherwise.
*/
bool operator()(const CancellationContext& lhs,
const CancellationContext& rhs) const;
};

} // namespace client
} // namespace olp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,10 @@ inline size_t CancellationContextHash::operator()(
context.impl_);
}

inline bool CancellationContextEquality::operator()(
const CancellationContext& lhs, const CancellationContext& rhs) const {
return lhs.impl_ == rhs.impl_;
}

} // namespace client
} // namespace olp
Loading