Skip to content

Commit e20f13f

Browse files
committed
RoomMessageEvent: make msgTypes constexpr
It actually should be std::array, not std::vector; and now that std::to_array() is available everywhere, the initialisation can be made quite neat, too.
1 parent 5c8ac8a commit e20f13f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/events/roommessageevent.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct MsgTypeDesc {
4949
TypedBase* (*maker)(const QJsonObject&);
5050
};
5151

52-
const std::vector<MsgTypeDesc> msgTypes = {
52+
constexpr auto msgTypes = std::to_array<MsgTypeDesc>({
5353
{ TextTypeKey, MsgType::Text, make<TextContent> },
5454
{ EmoteTypeKey, MsgType::Emote, make<TextContent> },
5555
{ NoticeTypeKey, MsgType::Notice, make<TextContent> },
@@ -58,7 +58,7 @@ const std::vector<MsgTypeDesc> msgTypes = {
5858
{ "m.location"_ls, MsgType::Location, make<LocationContent> },
5959
{ "m.video"_ls, MsgType::Video, make<VideoContent> },
6060
{ "m.audio"_ls, MsgType::Audio, make<AudioContent> }
61-
};
61+
});
6262

6363
QString msgTypeToJson(MsgType enumType)
6464
{

0 commit comments

Comments
 (0)