Commit 96fe9307 authored by Hwanseung Lee's avatar Hwanseung Lee Committed by Commit Bot

[Autofill] use vector.emplace_back instead of push_back with pair

Instead of some_vector.push_back(std::make_pair(a, b))
we can use some_vector.emplace_back(a, b)

Bug: 798758
Change-Id: Ib470b5b809a255933706fb03db3cf9ce81fa9fef
Reviewed-on: https://chromium-review.googlesource.com/848485
Commit-Queue: Mathieu Perreault <mathp@chromium.org>
Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526981}
parent 525e3af8
......@@ -87,9 +87,9 @@ void RegionComboboxModel::OnRegionDataLoaded(
// Some countries expose a state field but have no region names available.
if (regions.size() > 0) {
failed_to_load_data_ = false;
regions_.push_back(std::make_pair("", "---"));
regions_.emplace_back("", "---");
for (auto* const region : regions) {
regions_.push_back(std::make_pair(region->key(), region->name()));
regions_.emplace_back(region->key(), region->name());
}
} else {
// TODO(mad): Maybe use a static list as is done for countries in
......
......@@ -32,8 +32,8 @@ TEST(RegionComboboxModelTest, QuebecOntarioRegions) {
model.LoadRegionData("", &test_region_data_loader, 0);
std::vector<std::pair<std::string, std::string>> regions;
regions.push_back(std::make_pair(kQuebecCode, kQuebecName));
regions.push_back(std::make_pair(kOntarioCode, kOntarioName));
regions.emplace_back(kQuebecCode, kQuebecName);
regions.emplace_back(kOntarioCode, kOntarioName);
test_region_data_loader.SendAsynchronousData(regions);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment