ptr_container_adapter.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // Boost.Pointer Container
  3. //
  4. // Copyright Thorsten Ottosen 2003-2005. Use, modification and
  5. // distribution is subject to the Boost Software License, Version
  6. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // For more information, see http://www.boost.org/libs/ptr_container/
  10. //
  11. #include "sequence_test_data.hpp"
  12. #include <boost/ptr_container/ptr_container_adapter.hpp>
  13. #include <list>
  14. template< class T >
  15. class my_list : public std::list<T>
  16. {
  17. typedef BOOST_DEDUCED_TYPENAME std::list<T> base_class;
  18. public:
  19. /*
  20. my_list( const base_class::allocator_type& alloc = base_class::allocator_type() )
  21. : base_class( alloc ) {}
  22. my_list( size_type n, const T& x, const base_class::allocator_type& alloc = base_class::allocator_type() )
  23. : base_class( n, x, alloc ) {}
  24. template< class InputIterator >
  25. my_list( InputIterator first, InputIterator last ) : base_class( first, last ) {}
  26. */
  27. };
  28. void test_container_adapter()
  29. {
  30. typedef ptr_container_adapter< my_list<Base*> > base_ptr_list;
  31. typedef ptr_container_adapter< my_list<Value*> > value_ptr_list;
  32. typedef_test< base_ptr_list, Derived_class >();
  33. typedef_test< value_ptr_list, Value >();
  34. // reversible_container_test< base_ptr_list, Base, Derived_class >();
  35. // reversible_container_test< value_ptr_list, Value, Value >();
  36. base_ptr_list l;
  37. l.push_back( new Derived_class );
  38. l.push_back( new Derived_class );
  39. // algo_test< ptr_list<Value>, Value >();
  40. // algo_test_polymorphic< ptr_list<Base>, Derived_class >();
  41. }
  42. #include <boost/test/included/unit_test.hpp>
  43. using boost::unit_test::test_suite;
  44. test_suite* init_unit_test_suite( int argc, char* argv[] )
  45. {
  46. test_suite* test = BOOST_TEST_SUITE( "Pointer Container Test Suite" );
  47. test->add( BOOST_TEST_CASE( &test_container_adapter ) );
  48. return test;
  49. }