Skip to content

Commit e8eca99

Browse files
authored
Add clone method to Reply (#290)
* Add clone method to Reply Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Fixed docs Signed-off-by: Alejandro Hernández Cordero <[email protected]> * fix Signed-off-by: Alejandro Hernández Cordero <[email protected]> * feedback Signed-off-by: Alejandro Hernández Cordero <[email protected]> --------- Signed-off-by: Alejandro Hernández Cordero <[email protected]>
1 parent 1399621 commit e8eca99

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

include/zenoh/api/reply.hxx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,16 @@ class Reply : public Owned<::z_owned_reply_t> {
8484
return {};
8585
}
8686
#endif
87+
88+
/// @brief Construct a shallow copy of this Reply.
89+
///
90+
/// The reply will be sent only when the last clone is destroyed.
91+
Reply clone() const {
92+
Reply reply(zenoh::detail::null_object);
93+
::z_reply_clone(&reply._0, interop::as_loaned_c_ptr(*this));
94+
return reply;
95+
};
8796
};
8897

8998
} // namespace zenoh
90-
#endif
99+
#endif

0 commit comments

Comments
 (0)