]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use ostream_joiner to print arrays
authorKefu Chai <kchai@redhat.com>
Thu, 16 Nov 2017 04:20:28 +0000 (12:20 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 16 Nov 2017 05:08:57 +0000 (13:08 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/rgw/rgw_iam_policy.cc

index e07c7c02a9f2d1c8976358f137ec9c1c741c9e58..1d9e2e53666c1377f893b30a562cd1e4ce63f911 100644 (file)
@@ -1185,20 +1185,12 @@ const char* condop_string(const TokenID t) {
 template<typename Iterator>
 ostream& print_array(ostream& m, Iterator begin, Iterator end) {
   if (begin == end) {
-    m << "[";
+    m << "[]";
   } else {
-    auto beforelast = end - 1;
     m << "[ ";
-    for (auto i = begin; i != end; ++i) {
-      m << *i;
-      if (i != beforelast) {
-       m << ", ";
-      } else {
-       m << " ";
-      }
-    }
+    std::copy(begin, end, ceph::make_ostream_joiner(m, ", "));
+    m << " ]";
   }
-  m << "]";
   return m;
 }
 }