From ea9f0fc374bb1509be98dcc9d37573c47397add2 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 16 Nov 2015 16:42:51 -0500 Subject: [PATCH] rgw: use std::move for strings in RGWFetchAllMetaCR Signed-off-by: Casey Bodley --- src/rgw/rgw_sync.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index 0279a94cb02..4c7e9961869 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -589,7 +589,7 @@ public: void append_section_from_set(set& all_sections, const string& name) { set::iterator iter = all_sections.find(name); if (iter != all_sections.end()) { - sections.push_back(name); + sections.emplace_back(std::move(*iter)); all_sections.erase(iter); } } @@ -599,17 +599,16 @@ public: */ void rearrange_sections() { set all_sections; - for (list::iterator iter = sections.begin(); iter != sections.end(); ++iter) { - all_sections.insert(*iter); - } + std::move(sections.begin(), sections.end(), + std::inserter(all_sections, all_sections.end())); sections.clear(); + append_section_from_set(all_sections, "user"); append_section_from_set(all_sections, "bucket.instance"); append_section_from_set(all_sections, "bucket"); - for (set::iterator iter = all_sections.begin(); iter != all_sections.end(); ++iter) { - sections.push_back(*iter); - } + std::move(all_sections.begin(), all_sections.end(), + std::back_inserter(sections)); } int operate() { -- 2.47.3