]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | ++++++++++++++++++++++++++++++++++ |
2 | |Boost| Pointer Container Library | |
3 | ++++++++++++++++++++++++++++++++++ | |
4 | ||
5 | .. |Boost| image:: boost.png | |
6 | ||
7 | Class ``ptr_list`` | |
8 | ------------------ | |
9 | ||
10 | A ``ptr_list<T>`` is a pointer container that uses an underlying ``std:list<void*>`` | |
11 | to store the pointers. | |
12 | ||
13 | **Hierarchy:** | |
14 | ||
15 | - `reversible_ptr_container <reversible_ptr_container.html>`_ | |
16 | ||
17 | - `ptr_sequence_adapter <ptr_sequence_adapter.html>`_ | |
18 | ||
19 | - `ptr_vector <ptr_vector.html>`_ | |
20 | - ``ptr_list`` | |
21 | - `ptr_deque <ptr_deque.html>`_ | |
22 | - `ptr_array <ptr_array.html>`_ | |
23 | ||
24 | **Navigate:** | |
25 | ||
26 | - `home <ptr_container.html>`_ | |
27 | - `reference <reference.html>`_ | |
28 | ||
29 | ||
30 | **Synopsis:** | |
31 | ||
32 | .. parsed-literal:: | |
33 | ||
34 | namespace boost | |
35 | { | |
36 | ||
37 | template | |
38 | < | |
39 | class T, | |
40 | class CloneAllocator = heap_clone_allocator, | |
41 | class Allocator = std::allocator<void*> | |
42 | > | |
43 | class ptr_list : public ptr_sequence_adapter | |
44 | < | |
45 | T, | |
46 | std::list<void*,Allocator>, | |
47 | CloneAllocator | |
48 | > | |
49 | { | |
50 | ||
51 | public: // modifiers_ | |
52 | void push_front( T* x ); | |
53 | template< class U > | |
54 | void push_front( std::auto_ptr<U> x ); | |
55 | auto_type pop_front(); | |
56 | ||
57 | public: // `list operations`_ | |
58 | void reverse(); | |
59 | ||
60 | }; // class 'ptr_list' | |
61 | ||
62 | } // namespace 'boost' | |
63 | ||
64 | ||
65 | Semantics | |
66 | --------- | |
67 | ||
68 | .. _modifiers: | |
69 | ||
70 | Semantics: modifiers | |
71 | ^^^^^^^^^^^^^^^^^^^^ | |
72 | ||
73 | - ``void push_front( T* x );`` | |
74 | ||
75 | - Requirements: ``x != 0`` | |
76 | ||
77 | - Effects: Inserts the pointer into container and takes ownership of it | |
78 | ||
79 | - Throws: ``bad_pointer`` if ``x == 0`` | |
80 | ||
81 | - Exception safety: Strong guarantee | |
82 | ||
83 | - ``template< class U > void push_front( std::auto_ptr<U> x );`` | |
84 | ||
85 | - Effects: ``push_front( x.release() );`` | |
86 | ||
87 | .. | |
88 | - ``void push_front( const T& x );`` | |
89 | ||
90 | - Effects: push_front( allocate_clone( x ) ); | |
91 | ||
92 | - Exception safety: Strong guarantee | |
93 | ||
94 | - ``auto_type pop_front():`` | |
95 | ||
96 | - Requirements:``not empty()`` | |
97 | ||
98 | - Effects: Removes the first element in the container | |
99 | ||
100 | - Postconditions: ``size()`` is one less | |
101 | ||
102 | - Throws: ``bad_ptr_container_operation`` if ``empty() == true`` | |
103 | ||
104 | - Exception safety: Strong guarantee | |
105 | ||
106 | .. _`list operations`: | |
107 | ||
108 | Semantics: list operations | |
109 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
110 | ||
111 | .. | |
112 | - ``void splice( iterator before, ptr_list& x );`` | |
113 | ||
114 | - Requirements:``&x != this`` | |
115 | ||
116 | - Effects: inserts the all of ``x``'s elements before ``before`` | |
117 | ||
118 | - Postconditions: ``x.empty()`` | |
119 | ||
120 | - Throws: nothing | |
121 | ||
122 | - Remark: prefer this to ``transfer( before, x );`` | |
123 | ||
124 | - ``void splice( iterator before, ptr_list& x, iterator i );`` | |
125 | ||
126 | - Not ready yet | |
127 | ||
128 | - ``void splice( iterator before, ptr_list& x, iterator first, iterator last );`` | |
129 | ||
130 | - Not ready yet | |
131 | ||
132 | - ``void merge( ptr_list& x );`` | |
133 | ||
134 | - Not ready yet | |
135 | ||
136 | - ``template< typename Compare > | |
137 | void merge( ptr_list& x, Compare comp );`` | |
138 | ||
139 | - Not ready yet | |
140 | ||
141 | - ``void reverse();`` | |
142 | ||
143 | - Effects: reverses the underlying sequence | |
144 | ||
145 | - Throws: nothing | |
146 | ||
147 | .. raw:: html | |
148 | ||
149 | <hr> | |
150 | ||
151 | :Copyright: Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt__). | |
152 | ||
153 | __ http://www.boost.org/LICENSE_1_0.txt | |
154 | ||
155 |