Use emplace whenever possible.
GitOrigin-RevId: 67cd8e3b6331c5e1671a9d662f034af1e29d3ac6
This commit is contained in:
parent
cae55c5a54
commit
e16952121b
@ -164,7 +164,7 @@ void gen_tl_constructor_from_string(StringBuilder &sb, const tl::simple::Schema
|
|||||||
}
|
}
|
||||||
Vec vec;
|
Vec vec;
|
||||||
for (auto *constructor : custom_type->constructors) {
|
for (auto *constructor : custom_type->constructors) {
|
||||||
vec.push_back(std::make_pair(constructor->id, constructor->name));
|
vec.emplace_back(constructor->id, constructor->name);
|
||||||
vec_for_nullary.push_back(vec.back());
|
vec_for_nullary.push_back(vec.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ void gen_tl_constructor_from_string(StringBuilder &sb, const tl::simple::Schema
|
|||||||
}
|
}
|
||||||
Vec vec_for_function;
|
Vec vec_for_function;
|
||||||
for (auto *function : schema.functions) {
|
for (auto *function : schema.functions) {
|
||||||
vec_for_function.push_back(std::make_pair(function->id, function->name));
|
vec_for_function.emplace_back(function->id, function->name);
|
||||||
}
|
}
|
||||||
gen_tl_constructor_from_string(sb, "Function", vec_for_function, is_header);
|
gen_tl_constructor_from_string(sb, "Function", vec_for_function, is_header);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ std::string TD_TL_writer_h::gen_flags_definitions(const tl::tl_combinator *t) co
|
|||||||
for (auto &c : name) {
|
for (auto &c : name) {
|
||||||
c = to_upper(c);
|
c = to_upper(c);
|
||||||
}
|
}
|
||||||
flags.push_back(std::make_pair(name, a.exist_var_bit));
|
flags.emplace_back(name, a.exist_var_bit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string res;
|
std::string res;
|
||||||
|
@ -35,7 +35,7 @@ void RawConnection::send_crypto(const Storer &storer, int64 session_id, int64 sa
|
|||||||
|
|
||||||
bool use_quick_ack = false;
|
bool use_quick_ack = false;
|
||||||
if (quick_ack_token != 0 && transport_->support_quick_ack()) {
|
if (quick_ack_token != 0 && transport_->support_quick_ack()) {
|
||||||
auto tmp = quick_ack_to_token_.insert(std::make_pair(info.message_ack, quick_ack_token));
|
auto tmp = quick_ack_to_token_.emplace(info.message_ack, quick_ack_token);
|
||||||
if (tmp.second) {
|
if (tmp.second) {
|
||||||
use_quick_ack = true;
|
use_quick_ack = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -564,7 +564,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
|
|||||||
while (get_expiring_messages_stmt_.has_row()) {
|
while (get_expiring_messages_stmt_.has_row()) {
|
||||||
DialogId dialog_id(get_expiring_messages_stmt_.view_int64(0));
|
DialogId dialog_id(get_expiring_messages_stmt_.view_int64(0));
|
||||||
BufferSlice data(get_expiring_messages_stmt_.view_blob(1));
|
BufferSlice data(get_expiring_messages_stmt_.view_blob(1));
|
||||||
messages.push_back(std::make_pair(dialog_id, std::move(data)));
|
messages.emplace_back(dialog_id, std::move(data));
|
||||||
get_expiring_messages_stmt_.step().ensure();
|
get_expiring_messages_stmt_.step().ensure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ void FileGenerateManager::generate_file(uint64 query_id, FullGenerateFileLocatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
CHECK(query_id != 0);
|
CHECK(query_id != 0);
|
||||||
auto it_flag = query_id_to_query_.insert(std::make_pair(query_id, Query{}));
|
auto it_flag = query_id_to_query_.emplace(query_id, Query{});
|
||||||
LOG_CHECK(it_flag.second) << "Query id must be unique";
|
LOG_CHECK(it_flag.second) << "Query id must be unique";
|
||||||
auto parent = actor_shared(this, query_id);
|
auto parent = actor_shared(this, query_id);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ void FileStats::apply_dialog_limit(int32 limit) {
|
|||||||
for (auto &it : dialog.second) {
|
for (auto &it : dialog.second) {
|
||||||
size += it.size;
|
size += it.size;
|
||||||
}
|
}
|
||||||
dialogs.push_back(std::make_pair(size, dialog.first));
|
dialogs.emplace_back(size, dialog.first);
|
||||||
}
|
}
|
||||||
size_t prefix = dialogs.size();
|
size_t prefix = dialogs.size();
|
||||||
if (prefix > static_cast<size_t>(limit)) {
|
if (prefix > static_cast<size_t>(limit)) {
|
||||||
|
@ -991,7 +991,7 @@ void ConnectionCreator::client_add_connection(size_t hash, Result<unique_ptr<mtp
|
|||||||
VLOG(connections) << "Add ready connection " << r_raw_connection.ok().get() << " for "
|
VLOG(connections) << "Add ready connection " << r_raw_connection.ok().get() << " for "
|
||||||
<< tag("client", format::as_hex(hash));
|
<< tag("client", format::as_hex(hash));
|
||||||
client.backoff.clear();
|
client.backoff.clear();
|
||||||
client.ready_connections.push_back(std::make_pair(r_raw_connection.move_as_ok(), Time::now_cached()));
|
client.ready_connections.emplace_back(r_raw_connection.move_as_ok(), Time::now_cached());
|
||||||
} else {
|
} else {
|
||||||
if (r_raw_connection.error().code() == -404 && client.auth_data &&
|
if (r_raw_connection.error().code() == -404 && client.auth_data &&
|
||||||
client.auth_data_generation == auth_data_generation) {
|
client.auth_data_generation == auth_data_generation) {
|
||||||
|
@ -176,7 +176,7 @@ DcOptionsSet::DcOptionInfo *DcOptionsSet::register_dc_option(DcOption &&option)
|
|||||||
|
|
||||||
void DcOptionsSet::init_option_stat(DcOptionInfo *option_info) {
|
void DcOptionsSet::init_option_stat(DcOptionInfo *option_info) {
|
||||||
const auto &ip_address = option_info->option.get_ip_address();
|
const auto &ip_address = option_info->option.get_ip_address();
|
||||||
auto it_ok = option_to_stat_id_.insert(std::make_pair(ip_address, 0));
|
auto it_ok = option_to_stat_id_.emplace(ip_address, 0);
|
||||||
if (it_ok.second) {
|
if (it_ok.second) {
|
||||||
it_ok.first->second = option_stats_.create(make_unique<OptionStat>());
|
it_ok.first->second = option_stats_.create(make_unique<OptionStat>());
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ class QueryActor final : public Actor {
|
|||||||
} else {
|
} else {
|
||||||
future.set_event(EventCreator::raw(actor_id(), query.query_id));
|
future.set_event(EventCreator::raw(actor_id(), query.query_id));
|
||||||
auto query_id = query.query_id;
|
auto query_id = query.query_id;
|
||||||
pending_.insert(std::make_pair(query_id, std::make_pair(std::move(future), std::move(query))));
|
pending_.emplace(query_id, std::make_pair(std::move(future), std::move(query)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (threads_n_ > 1 && Random::fast(0, 9) == 0) {
|
if (threads_n_ > 1 && Random::fast(0, 9) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user