diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-08-11 17:01:41 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-08-11 17:01:41 +0900 |
commit | e9ae0d5eaac12a276ea352f1e633fb22cdd46828 (patch) | |
tree | 363d19a40e0e82b43d90059a66bba86d4c6e0d4a /lib/events/event.h | |
parent | a3223e749d6f6c72b7c0ef638a1314d8bc77bc06 (diff) | |
download | libquotient-e9ae0d5eaac12a276ea352f1e633fb22cdd46828.tar.gz libquotient-e9ae0d5eaac12a276ea352f1e633fb22cdd46828.zip |
Now that we're C++17, remove old compatibility cruft
Diffstat (limited to 'lib/events/event.h')
-rw-r--r-- | lib/events/event.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/events/event.h b/lib/events/event.h index d9c8e088..25362786 100644 --- a/lib/events/event.h +++ b/lib/events/event.h @@ -47,11 +47,10 @@ inline TargetEventT* weakPtrCast(const event_ptr_tt<EventT>& 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) +[[deprecated("Consider using eventCast() or visit() instead")]] +inline event_ptr_tt<TargetT> ptrCast(event_ptr_tt<SourceT>&& ptr) { - return unique_ptr_cast<TargetT>(ptr); + return std::unique_ptr<TargetT>(static_cast<TargetT*>(ptr.release())); } // === Standard Matrix key names and basicEventJson() === @@ -290,19 +289,19 @@ using Events = EventsArray<Event>; // This macro should be used in a public section of an event class to // provide matrixTypeId() and typeId(). -#define DEFINE_EVENT_TYPEID(_Id, _Type) \ - static constexpr event_mtype_t matrixTypeId() { return _Id; } \ - static auto typeId() { return Quotient::typeId<_Type>(); } \ +#define DEFINE_EVENT_TYPEID(_Id, _Type) \ + static constexpr event_mtype_t matrixTypeId() { return _Id; } \ + static auto typeId() { return Quotient::typeId<_Type>(); } \ // End of macro // This macro should be put after an event class definition (in .h or .cpp) // to enable its deserialisation from a /sync and other // polymorphic event arrays -#define REGISTER_EVENT_TYPE(_Type) \ - namespace { \ - [[gnu::unused]] static const auto _factoryAdded##_Type = \ - registerEventType<_Type>(); \ - } \ +#define REGISTER_EVENT_TYPE(_Type) \ + namespace { \ + [[maybe_unused]] static const auto _factoryAdded##_Type = \ + registerEventType<_Type>(); \ + } \ // End of macro // === is<>(), eventCast<>() and visit<>() === |