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 | |
12 | #include "sequence_test_data.hpp" |
13 | #include <boost/ptr_container/ptr_container_adapter.hpp> |
14 | #include <list> |
15 | |
16 | |
17 | template< class T > |
18 | class my_list : public std::list<T> |
19 | { |
20 | typedef BOOST_DEDUCED_TYPENAME std::list<T> base_class; |
21 | |
22 | public: |
23 | /* |
24 | my_list( const base_class::allocator_type& alloc = base_class::allocator_type() ) |
25 | : base_class( alloc ) {} |
26 | |
27 | my_list( size_type n, const T& x, const base_class::allocator_type& alloc = base_class::allocator_type() ) |
28 | : base_class( n, x, alloc ) {} |
29 | |
30 | template< class InputIterator > |
31 | my_list( InputIterator first, InputIterator last ) : base_class( first, last ) {} |
32 | */ |
33 | }; |
34 | |
35 | void test_container_adapter() |
36 | { |
37 | typedef ptr_container_adapter< my_list<Base*> > base_ptr_list; |
38 | typedef ptr_container_adapter< my_list<Value*> > value_ptr_list; |
39 | |
40 | typedef_test< base_ptr_list, Derived_class >(); |
41 | typedef_test< value_ptr_list, Value >(); |
42 | |
43 | // reversible_container_test< base_ptr_list, Base, Derived_class >(); |
44 | // reversible_container_test< value_ptr_list, Value, Value >(); |
45 | |
46 | base_ptr_list l; |
47 | l.push_back( new Derived_class ); |
48 | l.push_back( new Derived_class ); |
49 | |
50 | // algo_test< ptr_list<Value>, Value >(); |
51 | // algo_test_polymorphic< ptr_list<Base>, Derived_class >(); |
52 | } |
53 | |
54 | #include <boost/test/included/unit_test.hpp> |
55 | |
56 | using boost::unit_test::test_suite; |
57 | |
58 | test_suite* init_unit_test_suite( int argc, char* argv[] ) |
59 | { |
60 | test_suite* test = BOOST_TEST_SUITE( "Pointer Container Test Suite" ); |
61 | |
62 | test->add( BOOST_TEST_CASE( &test_container_adapter ) ); |
63 | |
64 | return test; |
65 | } |
66 | |
67 | |
68 | |
69 | |