diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index fd489610b..4307dbc9c 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -1310,13 +1310,8 @@ static Slice fix_url(Slice str) { } const FlatHashSet &get_valid_short_usernames() { - static const FlatHashSet valid_usernames = [] { - FlatHashSet result; - for (auto username : {"gif", "wiki", "vid", "bing", "pic", "bold", "imdb", "coub", "like", "vote"}) { - result.insert(Slice(username)); - } - return result; - }(); + static const FlatHashSet valid_usernames{"gif", "wiki", "vid", "bing", "pic", + "bold", "imdb", "coub", "like", "vote"}; return valid_usernames; } diff --git a/tdutils/td/utils/FlatHashTable.h b/tdutils/td/utils/FlatHashTable.h index 4bc852fd0..da12cf98e 100644 --- a/tdutils/td/utils/FlatHashTable.h +++ b/tdutils/td/utils/FlatHashTable.h @@ -226,6 +226,13 @@ class FlatHashTable { used_node_count_ = used_nodes; } + template + FlatHashTable(std::initializer_list keys) { + for (auto &key : keys) { + emplace(KeyT(key)); + } + } + FlatHashTable(FlatHashTable &&other) noexcept : nodes_(other.nodes_) , used_node_count_(other.used_node_count_)