Commit 2aab0671 authored by Dominik Charousset's avatar Dominik Charousset

Make actor_addr nullptr comparable/construbile

parent c03e6b9f
......@@ -58,8 +58,11 @@ public:
actor_addr& operator=(actor_addr&&) = default;
actor_addr& operator=(const actor_addr&) = default;
actor_addr(std::nullptr_t);
actor_addr(const unsafe_actor_handle_init_t&);
actor_addr& operator=(std::nullptr_t);
/// Returns the ID of this actor.
inline actor_id id() const noexcept {
return ptr_->id();
......@@ -122,13 +125,13 @@ public:
actor_addr(actor_control_block*, bool);
/// @endcond
private:
inline actor_control_block* get() const noexcept {
return ptr_.get();
}
/// @endcond
private:
inline actor_control_block* release() noexcept {
return ptr_.release();
}
......@@ -142,6 +145,22 @@ private:
weak_actor_ptr ptr_;
};
inline bool operator==(const actor_addr& x, std::nullptr_t) {
return x.get() == nullptr;
}
inline bool operator==(std::nullptr_t, const actor_addr& x) {
return x.get() == nullptr;
}
inline bool operator!=(const actor_addr& x, std::nullptr_t) {
return x.get() != nullptr;
}
inline bool operator!=(std::nullptr_t, const actor_addr& x) {
return x.get() != nullptr;
}
} // namespace caf
// allow actor_addr to be used in hash maps
......
......@@ -28,10 +28,19 @@
namespace caf {
actor_addr::actor_addr(std::nullptr_t) {
// nop
}
actor_addr::actor_addr(const unsafe_actor_handle_init_t&) {
// nop
}
actor_addr& actor_addr::operator=(std::nullptr_t) {
ptr_.reset();
return *this;
}
actor_addr::actor_addr(actor_control_block* ptr) : ptr_(ptr) {
// nop
}
......
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