Commit c91ace23 authored by Dominik Charousset's avatar Dominik Charousset

Fix comparison operators of intrusive_ptr

parent 35940fa4
...@@ -38,7 +38,7 @@ is based on [Keep a Changelog](https://keepachangelog.com). ...@@ -38,7 +38,7 @@ is based on [Keep a Changelog](https://keepachangelog.com).
- We renamed `caf::flow::item_publisher` to `caf::flow::multicaster` to better - We renamed `caf::flow::item_publisher` to `caf::flow::multicaster` to better
reflect its purpose and to avoid confusion with the new reflect its purpose and to avoid confusion with the new
`caf::async::publisher`. `caf::async::publisher`.
- When failing to deserialize a request, the sender will receive an error of - When failing to deserialize a request, the sender will receive an error of
kind `sec::malformed_message`. kind `sec::malformed_message`.
### Fixed ### Fixed
...@@ -48,6 +48,8 @@ is based on [Keep a Changelog](https://keepachangelog.com). ...@@ -48,6 +48,8 @@ is based on [Keep a Changelog](https://keepachangelog.com).
malformed output. malformed output.
- Fix handling of WebSocket frames that are exactly on the 65535 byte limit. - Fix handling of WebSocket frames that are exactly on the 65535 byte limit.
- Fix crash when using a fallback value for optional values (#1427). - Fix crash when using a fallback value for optional values (#1427).
- Fix the comparison operator of `intrusive_ptr` to make sure comparing to raw
pointers does not accidentally create a new `intrusive_ptr` instances.
## [0.19.2] - 2023-06-13 ## [0.19.2] - 2023-06-13
......
...@@ -231,27 +231,31 @@ bool operator!=(std::nullptr_t, const intrusive_ptr<T>& x) { ...@@ -231,27 +231,31 @@ bool operator!=(std::nullptr_t, const intrusive_ptr<T>& x) {
// -- comparison to raw pointer ------------------------------------------------ // -- comparison to raw pointer ------------------------------------------------
/// @relates intrusive_ptr /// @relates intrusive_ptr
template <class T> template <class T, class U>
bool operator==(const intrusive_ptr<T>& x, const T* y) { detail::enable_if_t<detail::is_comparable<T*, U*>::value, bool>
return x.get() == y; operator==(const intrusive_ptr<T>& lhs, const U* rhs) {
return lhs.get() == rhs;
} }
/// @relates intrusive_ptr /// @relates intrusive_ptr
template <class T> template <class T, class U>
bool operator==(const T* x, const intrusive_ptr<T>& y) { detail::enable_if_t<detail::is_comparable<T*, U*>::value, bool>
return x == y.get(); operator==(const T* lhs, const intrusive_ptr<U>& rhs) {
return lhs == rhs.get();
} }
/// @relates intrusive_ptr /// @relates intrusive_ptr
template <class T> template <class T, class U>
bool operator!=(const intrusive_ptr<T>& x, const T* y) { detail::enable_if_t<detail::is_comparable<T*, U*>::value, bool>
return x.get() != y; operator!=(const intrusive_ptr<T>& lhs, const U* rhs) {
return lhs.get() != rhs;
} }
/// @relates intrusive_ptr /// @relates intrusive_ptr
template <class T> template <class T, class U>
bool operator!=(const T* x, const intrusive_ptr<T>& y) { detail::enable_if_t<detail::is_comparable<T*, U*>::value, bool>
return x != y.get(); operator!=(const T* lhs, const intrusive_ptr<U>& rhs) {
return lhs != rhs.get();
} }
// -- comparison to intrusive_pointer ------------------------------------------ // -- comparison to intrusive_pointer ------------------------------------------
......
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