diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-05-18 21:48:04 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-05-18 21:48:04 +0900 |
commit | 7374cef74ab92dd2165831c73db51c7dfa4a3511 (patch) | |
tree | ef1cc23e5da487b1662930ac4f7a15b3884c2472 /lib/events/event.h | |
parent | 9ca07298008d891250ffc79771bc5ef8c97950cb (diff) | |
download | libquotient-7374cef74ab92dd2165831c73db51c7dfa4a3511.tar.gz libquotient-7374cef74ab92dd2165831c73db51c7dfa4a3511.zip |
event.h: add doc-comments; deprecate ptrCast()
Diffstat (limited to 'lib/events/event.h')
-rw-r--r-- | lib/events/event.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/events/event.h b/lib/events/event.h index d7ac4292..b7bbd83e 100644 --- a/lib/events/event.h +++ b/lib/events/event.h @@ -32,19 +32,23 @@ namespace QMatrixClient template <typename EventT> using event_ptr_tt = std::unique_ptr<EventT>; + /// Unwrap a plain pointer from a smart pointer template <typename EventT> - inline EventT* rawPtr(const event_ptr_tt<EventT>& ptr) // unwrap + inline EventT* rawPtr(const event_ptr_tt<EventT>& ptr) { return ptr.get(); } + /// Unwrap a plain pointer and downcast it to the specified type template <typename TargetEventT, typename EventT> inline TargetEventT* weakPtrCast(const event_ptr_tt<EventT>& ptr) { return static_cast<TargetEventT*>(rawPtr(ptr)); } + /// Re-wrap a smart pointer to base into a smart pointer to derived template <typename TargetT, typename SourceT> + [[deprecated("Consider using eventCast() or visit() instead")]] inline event_ptr_tt<TargetT> ptrCast(event_ptr_tt<SourceT>&& ptr) { return unique_ptr_cast<TargetT>(ptr); |