]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/test/test_snap_mapper.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / test / test_snap_mapper.cc
index 9b6dbdd2b0c59db43f956656624755cb25aced15..50730080d8dc7387dc52755cef827f3c5c9c05af 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+#include <iterator>
 #include <map>
 #include <set>
 #include <boost/scoped_ptr.hpp>
@@ -16,14 +17,10 @@ using namespace std;
 
 template <typename T>
 typename T::iterator rand_choose(T &cont) {
-  if (cont.size() == 0) {
-    return cont.end();
+  if (std::empty(cont)) {
+    return std::end(cont);
   }
-  int index = rand() % cont.size();
-  typename T::iterator retval = cont.begin();
-
-  for (; index > 0; --index) ++retval;
-  return retval;
+  return std::next(std::begin(cont), rand() % cont.size());
 }
 
 string random_string(size_t size)