Commit 53a9b74b authored by Jose Dapena Paz's avatar Jose Dapena Paz Committed by Commit Bot

libstdc++: do not assume std::pair copy constructor is available inserting omnibox pedals

In libstdc++, std::pair copy constructor is deleted. So inserting into a map with a pair
constructed with brace notation will fail, as it will imply a copy. Instead of that,
use make_pair for populating the map of omnibox pedal implementations.

Bug: 957519
Change-Id: I1de69e655c2aa6f8f7cbbd0de86613863aa2dd92
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1584293Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: José Dapena Paz <jose.dapena@lge.com>
Cr-Commit-Position: refs/heads/master@{#655964}
parent b510663a
...@@ -142,7 +142,7 @@ std::unordered_map<OmniboxPedalId, std::unique_ptr<OmniboxPedal>> ...@@ -142,7 +142,7 @@ std::unordered_map<OmniboxPedalId, std::unique_ptr<OmniboxPedal>>
GetPedalImplementations() { GetPedalImplementations() {
std::unordered_map<OmniboxPedalId, std::unique_ptr<OmniboxPedal>> pedals; std::unordered_map<OmniboxPedalId, std::unique_ptr<OmniboxPedal>> pedals;
const auto add = [&](OmniboxPedalId id, OmniboxPedal* pedal) { const auto add = [&](OmniboxPedalId id, OmniboxPedal* pedal) {
pedals.insert({id, std::unique_ptr<OmniboxPedal>(pedal)}); pedals.insert(std::make_pair(id, std::unique_ptr<OmniboxPedal>(pedal)));
}; };
add(OmniboxPedalId::CLEAR_BROWSING_DATA, new OmniboxPedalClearBrowsingData()); add(OmniboxPedalId::CLEAR_BROWSING_DATA, new OmniboxPedalClearBrowsingData());
add(OmniboxPedalId::CHANGE_SEARCH_ENGINE, add(OmniboxPedalId::CHANGE_SEARCH_ENGINE,
......
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