diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-08-01 18:09:47 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-09-04 18:42:11 +0200 |
commit | bde38f86337d6f49b34b38016ab088d2f48ec371 (patch) | |
tree | 66971b5864de14bbe17e2b7fa8cbf12adb325bf5 /lib/eventitem.h | |
parent | 575534e7cca310c6d6195ab16d482bf9dfba755e (diff) | |
download | libquotient-bde38f86337d6f49b34b38016ab088d2f48ec371.tar.gz libquotient-bde38f86337d6f49b34b38016ab088d2f48ec371.zip |
concept EventClass
Constrain types to derive from Event (or the chosen class), where
applicable.
Diffstat (limited to 'lib/eventitem.h')
-rw-r--r-- | lib/eventitem.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/eventitem.h b/lib/eventitem.h index 2e55a724..445f8265 100644 --- a/lib/eventitem.h +++ b/lib/eventitem.h @@ -46,7 +46,7 @@ public: const RoomEvent* event() const { return rawPtr(evt); } const RoomEvent* get() const { return event(); } - template <typename EventT> + template <EventClass<RoomEvent> EventT> const EventT* viewAs() const { return eventCast<const EventT>(evt); @@ -67,7 +67,7 @@ public: std::any& userData() { return data; } protected: - template <typename EventT> + template <EventClass<RoomEvent> EventT> EventT* getAs() { return eventCast<EventT>(evt); |