]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/intrusive/test/test_container.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / intrusive / test / test_container.hpp
index b186920257056ecbead06babe16b1f6ab009d6c8..6e98071f2de9fdf59a61cfc839f8b53e513d6341 100644 (file)
 #include <boost/intrusive/detail/simple_disposers.hpp>
 #include <boost/intrusive/detail/iterator.hpp>
 #include <boost/move/utility_core.hpp>
+#include <boost/move/adl_move_swap.hpp>
 #include <boost/intrusive/detail/mpl.hpp>
 #include <boost/static_assert.hpp>
 #include "iterator_test.hpp"
+#include <cstdlib>
 
 namespace boost {
 namespace intrusive {
@@ -552,6 +554,19 @@ template< class Container, class Data >
 void test_maybe_unique_container(Container & c, Data & d, detail::true_)//!is_unique
 {  test_non_unique_container(c, d);  }
 
+template< class RandomIt >
+void random_shuffle( RandomIt first, RandomIt last )
+{
+   typedef typename boost::intrusive::iterator_traits<RandomIt>::difference_type difference_type;
+   difference_type n = last - first;
+   for (difference_type i = n-1; i > 0; --i) {
+      difference_type j = std::rand() % (i+1);
+      if(j != i) {
+         boost::adl_move_swap(first[i], first[j]);
+      }
+   }
+}
+
 }}}
 
 #endif   //#ifndef BOOST_INTRUSIVE_TEST_CONTAINER_HPP