Skip to content

Commit

Permalink
RoomMessageEvent: make msgTypes constexpr
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
KitsuneRal committed Jan 23, 2023
1 parent 5c8ac8a commit e20f13f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/events/roommessageevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct MsgTypeDesc {
TypedBase* (*maker)(const QJsonObject&);
};

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

QString msgTypeToJson(MsgType enumType)
{
Expand Down

0 comments on commit e20f13f

Please sign in to comment.