Add static assert for array size.

GitOrigin-RevId: 1f044bd3c05346316d27c7ae0462a2b0d575168a
This commit is contained in:
levlam 2020-08-23 21:25:06 +03:00
parent 3305ca5689
commit b575ed9a98
2 changed files with 3 additions and 1 deletions

View File

@ -26,6 +26,7 @@ namespace td {
int MessageEntity::get_type_priority(Type type) {
static const int types[] = {50, 50, 50, 50, 50, 90, 91, 20, 11, 10, 49, 49, 50, 50, 92, 93, 0, 50};
static_assert(sizeof(types) / sizeof(types[0]) == static_cast<size_t>(MessageEntity::Type::Size), "");
return types[static_cast<int32>(type)];
}

View File

@ -47,7 +47,8 @@ class MessageEntity {
Underline,
Strikethrough,
BlockQuote,
BankCardNumber
BankCardNumber,
Size
};
Type type;
int32 offset;