--- a/src/basics.h Sat Apr 08 16:12:12 2023 +0300 +++ b/src/basics.h Sat Apr 08 16:41:40 2023 +0300 @@ -345,3 +345,14 @@ { return Message{.time = QDateTime::currentDateTime(), .type = Message::Error, .text = text}; } + +template<typename BaseType, typename MemberType, typename DataType> +struct MemberData +{ + std::size_t member; + DataType payload; + constexpr MemberType memberInstance(BaseType* instance) const + { + return *reinterpret_cast<MemberType*>(reinterpret_cast<char*>(instance) + this->member); + } +};