mirror of https://github.com/procxx/kepka.git
parent
af818b40aa
commit
606a90a4ac
|
@ -168,11 +168,20 @@ void AppendFoundEmoji(
|
|||
std::vector<Result> &result,
|
||||
const QString &label,
|
||||
const std::vector<LangPackEmoji> &list) {
|
||||
// It is important that the 'result' won't relocate while inserting.
|
||||
result.reserve(result.size() + list.size());
|
||||
const auto alreadyBegin = result.data();
|
||||
const auto alreadyEnd = alreadyBegin + result.size();
|
||||
|
||||
auto &&add = ranges::view::all(
|
||||
list
|
||||
) | ranges::view::filter([&](const LangPackEmoji &entry) {
|
||||
const auto i = ranges::find(result, entry.emoji, &Result::emoji);
|
||||
return (i == end(result));
|
||||
const auto i = ranges::find(
|
||||
alreadyBegin,
|
||||
alreadyEnd,
|
||||
entry.emoji,
|
||||
&Result::emoji);
|
||||
return (i == alreadyEnd);
|
||||
}) | ranges::view::transform([&](const LangPackEmoji &entry) {
|
||||
return Result{ entry.emoji, label, entry.text };
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue