//
#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();
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 );
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();
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() );
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
#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 );
BOOST_TEST_MESSAGE( "finished random accessors algorithms test" );
}
+#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
+#pragma GCC diagnostic pop
+#endif