Use td::remove instead of std::remove.

GitOrigin-RevId: f64e6d2199f1b9049e2bc022de1f65c9efba6647
This commit is contained in:
levlam 2019-10-22 01:29:19 +03:00
parent c69beaf037
commit e84e131efd
3 changed files with 7 additions and 11 deletions

View File

@ -7741,9 +7741,7 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from
if (c->is_username_changed) {
if (c->status.is_creator() && created_public_channels_inited_) {
if (c->username.empty()) {
created_public_channels_.erase(
std::remove(created_public_channels_.begin(), created_public_channels_.end(), channel_id),
created_public_channels_.end());
td::remove(created_public_channels_, channel_id);
} else {
if (std::find(created_public_channels_.begin(), created_public_channels_.end(), channel_id) ==
created_public_channels_.end()) {
@ -11298,8 +11296,7 @@ void ContactsManager::on_update_secret_chat(SecretChatId secret_chat_id, int64 a
if (secret_chat->user_id.is_valid()) {
LOG(ERROR) << "Secret chat user has changed from " << secret_chat->user_id << " to " << user_id;
auto &old_secret_chat_ids = secret_chats_with_user_[secret_chat->user_id];
old_secret_chat_ids.erase(std::remove(old_secret_chat_ids.begin(), old_secret_chat_ids.end(), secret_chat_id),
old_secret_chat_ids.end());
td::remove(old_secret_chat_ids, secret_chat_id);
}
secret_chat->user_id = user_id;
secret_chats_with_user_[secret_chat->user_id].push_back(secret_chat_id);

View File

@ -2641,8 +2641,7 @@ void StickersManager::on_update_sticker_set(StickerSet *sticker_set, bool is_ins
sticker_set_ids.insert(sticker_set_ids.begin(), sticker_set->id);
} else {
installed_sticker_sets_hints_[sticker_set->is_masks].remove(sticker_set->id.get());
sticker_set_ids.erase(std::remove(sticker_set_ids.begin(), sticker_set_ids.end(), sticker_set->id),
sticker_set_ids.end());
td::remove(sticker_set_ids, sticker_set->id);
}
}
if (was_archived != is_archived && is_changed) {
@ -2663,8 +2662,7 @@ void StickersManager::on_update_sticker_set(StickerSet *sticker_set, bool is_ins
LOG(ERROR) << "Total count of archived sticker sets became negative";
total_count = 0;
}
sticker_set_ids.erase(std::remove(sticker_set_ids.begin(), sticker_set_ids.end(), sticker_set->id),
sticker_set_ids.end());
td::remove(sticker_set_ids, sticker_set->id);
}
}
}

View File

@ -48,8 +48,9 @@ string clean_name(string str, size_t max_length) {
}
string clean_username(string str) {
str.resize(std::remove(str.begin(), str.end(), '.') - str.begin());
return trim(to_lower(str));
td::remove(str, '.');
to_lower_inplace(str);
return trim(str);
}
bool clean_input_string(string &str) {