X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fboost%2Flibs%2Fintrusive%2Ftest%2Ftest_container.hpp;h=6e98071f2de9fdf59a61cfc839f8b53e513d6341;hb=b32b81446b3b05102be0267e79203f59329c1d97;hp=b186920257056ecbead06babe16b1f6ab009d6c8;hpb=215dd7151453fae88e6f968c975b6ce309d42dcf;p=ceph.git diff --git a/ceph/src/boost/libs/intrusive/test/test_container.hpp b/ceph/src/boost/libs/intrusive/test/test_container.hpp index b18692025..6e98071f2 100644 --- a/ceph/src/boost/libs/intrusive/test/test_container.hpp +++ b/ceph/src/boost/libs/intrusive/test/test_container.hpp @@ -18,9 +18,11 @@ #include #include #include +#include #include #include #include "iterator_test.hpp" +#include 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::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