]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use std::move for strings in RGWFetchAllMetaCR
authorCasey Bodley <cbodley@redhat.com>
Mon, 16 Nov 2015 21:42:51 +0000 (16:42 -0500)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 18 Feb 2016 22:04:19 +0000 (14:04 -0800)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_sync.cc

index 0279a94cb029db29bc12eb8194c4d2852722e984..4c7e9961869943202f37d306a0041e2b32283db3 100644 (file)
@@ -589,7 +589,7 @@ public:
   void append_section_from_set(set<string>& all_sections, const string& name) {
     set<string>::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<string> all_sections;
-    for (list<string>::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<string>::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() {