]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/ptr_container/test/sequence_test_data.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / libs / ptr_container / test / sequence_test_data.hpp
index d6f40904ace6a986fe89db974d5a305e28fee131..6d3c43a23771a718604f591dd2be5d3f6265bce1 100644 (file)
 //
 
 #include "test_data.hpp"
+#include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
 #include <boost/range/iterator_range.hpp>
 #include <boost/bind.hpp>
 
+#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
 template< typename C, typename B, typename T >
 void reversible_container_test();
 
@@ -25,7 +31,7 @@ void reversible_container_test()
     using namespace boost;
     
     BOOST_TEST_MESSAGE( "starting reversible container test" ); 
-    enum { max_cnt = 10, size = 100 };
+    enum { max_cnt = 10 };
     C  c;
     set_capacity<C>()( c );
     BOOST_CHECK( c.size() == 0 );
@@ -63,11 +69,17 @@ void reversible_container_test()
     BOOST_DEDUCED_TYPENAME C::iterator i                  = c.begin();
     BOOST_DEDUCED_TYPENAME C::const_iterator ci           = c2.begin();
     BOOST_DEDUCED_TYPENAME C::iterator i2                 = c.end();
+    hide_warning(i2);
     BOOST_DEDUCED_TYPENAME C::const_iterator ci2          = c2.begin();
+    hide_warning(ci2);
     BOOST_DEDUCED_TYPENAME C::reverse_iterator ri         = c.rbegin();
+    hide_warning(ri);
     BOOST_DEDUCED_TYPENAME C::const_reverse_iterator cri  = c2.rbegin();
+    hide_warning(cri);
     BOOST_DEDUCED_TYPENAME C::reverse_iterator rv2        = c.rend();
+    hide_warning(rv2);
     BOOST_DEDUCED_TYPENAME C::const_reverse_iterator cvr2 = c2.rend();
+    hide_warning(cvr2);
     i  = c.rbegin().base();
     ci = c2.rbegin().base();
     i  = c.rend().base();
@@ -82,7 +94,15 @@ void reversible_container_test()
     BOOST_DEDUCED_TYPENAME C::size_type s2                = c.max_size();
     hide_warning(s2);
     c.push_back( new T );
+    std::size_t size = 2u;
+#ifndef BOOST_NO_AUTO_PTR
     c.push_back( std::auto_ptr<T>( new T ) );
+    ++size;
+#endif
+#ifndef BOOST_NO_CXX11_SMART_PTR
+    c.push_back( std::unique_ptr<T>( new T ) );
+    ++size;
+#endif
     bool b                                                = c.empty();
     BOOST_CHECK( !c.empty() );
     b                                                     = is_null( c.begin() );
@@ -98,14 +118,23 @@ void reversible_container_test()
     BOOST_TEST_MESSAGE( "finished accessors test" ); 
     
     c.push_back( new T );
-    BOOST_CHECK_EQUAL( c.size(), 4u );
+    ++size;
+    BOOST_CHECK_EQUAL( c.size(), size );
 
     c.pop_back(); 
     BOOST_CHECK( !c.empty() );
     c.insert( c.end(), new T );
+#ifndef BOOST_NO_AUTO_PTR
     std::auto_ptr<T> ap(new T);
     c.insert( c.end(), ap );
-    BOOST_CHECK_EQUAL( c.size(), 5u );
+    ++size;
+#endif
+#ifndef BOOST_NO_CXX11_SMART_PTR
+    std::unique_ptr<T> up( new T );
+    c.insert( c.end(), std::move( up ) );
+    ++size;
+#endif
+    BOOST_CHECK_EQUAL( c.size(), size );
 
 #if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
 #else
@@ -136,11 +165,20 @@ void reversible_container_test()
 #else
     auto_type ptr       = c.release( c.begin() );
 #endif    
-    std::auto_ptr<C> ap2 = c.release();
+#ifndef BOOST_NO_AUTO_PTR
+    std::auto_ptr<C> ap2   = c.release();
+#else
+    std::unique_ptr<C> up2 = c.release();
+#endif
     c                   = c2.clone();
     BOOST_CHECK( !c.empty() );
     auto_type ptr2      = c.replace( c.begin(), new T );
+#ifndef BOOST_NO_AUTO_PTR
     ptr2                = c.replace( c.begin(), std::auto_ptr<T>( new T ) );
+#endif
+#ifndef BOOST_NO_CXX11_SMART_PTR
+    ptr2                = c.replace( c.begin(), std::unique_ptr<T>( new T ) );
+#endif
     BOOST_TEST_MESSAGE( "finished release/clone/replace test" ); 
                      
     c3.push_back( new T );
@@ -299,3 +337,6 @@ void random_access_algorithms_test()
     BOOST_TEST_MESSAGE( "finished random accessors algorithms test" );
 }
 
+#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
+#pragma GCC diagnostic pop
+#endif