1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
++++++++++++++++++++++++++++++++++
|Boost| Pointer Container Library
++++++++++++++++++++++++++++++++++
.. |Boost| image:: boost.png
Class ``ptr_deque``
--------------------
A ``ptr_deque<T>`` is a pointer container that uses an underlying ``std:deque<void*>``
to store the pointers.
**Hierarchy:**
- `reversible_ptr_container <reversible_ptr_container.html>`_
- `ptr_sequence_adapter <ptr_sequence_adapter.html>`_
- `ptr_vector <ptr_vector.html>`_
- `ptr_list <ptr_list.html>`_
- ``ptr_deque``
- `ptr_array <ptr_array.html>`_
**Navigate:**
- `home <ptr_container.html>`_
- `reference <reference.html>`_
**Synopsis:**
.. parsed-literal::
namespace boost
{
template
<
class T,
class CloneAllocator = heap_clone_allocator
class Allocator = std::allocator<void*>
>
class ptr_deque : public ptr_sequence_adapter
<
T,
std::deque<void*,Allocator>,
CloneAllocator
>
{
public: // `element access`_
T& operator[]( size_type n );
const T& operator[]( size_type n ) const;
T& at( size_type n );
const T& at( size_type n ) const;
public: // modifiers_
void push_front( T* x );
template< class U >
void push_front( compatible-smart-ptr<U> x );
auto_type pop_front();
public: // `pointer container requirements`_
auto_type replace( size_type idx, T* x );
template< class U >
auto_type replace( size_type idx, compatible-smart-ptr<U> x );
bool is_null( size_type idx ) const;
};
} // namespace 'boost'
.. _`reversible_ptr_container`: reversible_ptr_container.html
.. _`ptr_sequence_adapter`: ptr_sequence_adapter.html
Semantics
---------
.. _modifiers:
Semantics: modifiers
^^^^^^^^^^^^^^^^^^^^
- ``void push_front( T* x );``
- Requirements: ``x != 0``
- Effects: Inserts the pointer into container and takes ownership of it
- Throws: ``bad_pointer`` if ``x == 0``
- Exception safety: Strong guarantee
- ``template< class U > void push_front( compatible-smart-ptr<U> x );``
- Effects: ``push_front( x.release() );``
..
- ``void push_front( const T& x );``
- Effects: push_front( allocate_clone( x ) );
- Exception safety: Strong guarantee
- ``auto_type pop_front():``
- Requirements:``not empty()``
- Effects: Removes the first element in the container
- Postconditions: ``size()`` is one less
- Throws: ``bad_ptr_container_operation`` if ``empty() == true``
- Exception safety: Strong guarantee
.. _`element access`:
Semantics: element access
^^^^^^^^^^^^^^^^^^^^^^^^^
- ``T& operator[]( size_type n );``
- ``const T& operator[]( size_type n ) const;``
- Requirements: ``n < size()``
- Effects: Returns a reference to the ``n``'th element
- Throws: Nothing
- ``T& at( size_type n );``
- ``const T& at( size_type n ) const;``
- Requirements: ``n < size()``
- Effects: Returns a reference to the ``n``'th element
- Throws: ``bad_index`` if ``n >=size()``
.. _`pointer container requirements`:
Semantics: pointer container requirements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ``auto_type replace( size_type idx, T* x );``
- Requirements: `` x != 0 and idx < size()``
- Effects: returns the object indexed by ``idx`` and replaces it with ``x``.
- Throws: ``bad_index`` if ``idx >= size()`` and ``bad_pointer`` if ``x == 0``.
- Exception safety: Strong guarantee
- ``template< class U > auto_type replace( size_type idx, compatible-smart-ptr<U> x );``
- Effects: ``return replace( idx, x.release() );``
- ``bool is_null( size_type idx ) const;``
- Requirements: ``idx < size()``
- Effects: returns whether the pointer at index ``idx`` is null
- Exception safety: Nothrow guarantee
.. raw:: html
<hr/>
:Copyright: Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt__).
__ http://www.boost.org/LICENSE_1_0.txt
|