Simplify constant FlatHashSet initialization.
This commit is contained in:
parent
7bea39b6fa
commit
f3a1407f8f
@ -1310,13 +1310,8 @@ static Slice fix_url(Slice str) {
|
||||
}
|
||||
|
||||
const FlatHashSet<Slice, SliceHash> &get_valid_short_usernames() {
|
||||
static const FlatHashSet<Slice, SliceHash> valid_usernames = [] {
|
||||
FlatHashSet<Slice, SliceHash> result;
|
||||
for (auto username : {"gif", "wiki", "vid", "bing", "pic", "bold", "imdb", "coub", "like", "vote"}) {
|
||||
result.insert(Slice(username));
|
||||
}
|
||||
return result;
|
||||
}();
|
||||
static const FlatHashSet<Slice, SliceHash> valid_usernames{"gif", "wiki", "vid", "bing", "pic",
|
||||
"bold", "imdb", "coub", "like", "vote"};
|
||||
return valid_usernames;
|
||||
}
|
||||
|
||||
|
@ -226,6 +226,13 @@ class FlatHashTable {
|
||||
used_node_count_ = used_nodes;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
FlatHashTable(std::initializer_list<T> keys) {
|
||||
for (auto &key : keys) {
|
||||
emplace(KeyT(key));
|
||||
}
|
||||
}
|
||||
|
||||
FlatHashTable(FlatHashTable &&other) noexcept
|
||||
: nodes_(other.nodes_)
|
||||
, used_node_count_(other.used_node_count_)
|
||||
|
Loading…
Reference in New Issue
Block a user