1 ++++++++++++++++++++++++++++++++++
2 |Boost| Pointer Container Library
3 ++++++++++++++++++++++++++++++++++
5 .. |Boost| image:: boost.png
7 Class ``associative_ptr_container``
8 -------------------------------------
10 This section describes all the common operations for all associative
11 pointer containers (in addition to ``reversible_ptr_container``).
15 - `reversible_ptr_container <reversible_ptr_container.html>`_
17 - ``associative_ptr_container``
19 - `ptr_set_adapter <ptr_set_adapter.html>`_
20 - `ptr_multiset_adapter <ptr_multiset_adapter.html>`_
21 - `ptr_map_adapter <ptr_map_adapter.html>`_
22 - `ptr_multi_map_adapter <ptr_multimap_adapter.html>`_
24 - `ptr_set <ptr_set.html>`_
25 - `ptr_multi_set <ptr_multiset.html>`_
26 - `ptr_map <ptr_map.html>`_
27 - `ptr_multimap <ptr_multimap.html>`_
31 - `iterator_range <http://www.boost.org/libs/range/doc/utility_class.html#iter_range>`_
35 - `home <ptr_container.html>`_
36 - `reference <reference.html>`_
47 class CloneAllocator = heap_clone_allocator
49 class associative_ptr_container
53 typedef ... key_compare;
54 typedef ... value_compare;
56 public: // `observers`_
57 key_compare key_comp() const;
58 value_compare value_comp() const;
60 public: // `modifiers`_
61 template< typename InputIterator >
62 void insert( InputIterator first, InputIterator last );
63 template< class InputRange >
64 void insert( const InputRange& r );
65 void erase( iterator position );
66 size_type erase( const key_type& x );
67 template< class Range >
68 void erase( const Range& r );
69 void erase( iterator first, iterator last );
71 public: // `algorithms`_
72 iterator find( const key_type& x );
73 const_iterator find( const key_type& x ) const;
74 size_type count( const key_type& x ) const;
75 iterator lower_bound( const key_type& x );
76 const_iterator lower_bound( const key_type& x ) const;
77 iterator upper_bound( const key_type& x );
78 const_iterator upper_bound( const key_type& x ) const;
79 iterator_range<iterator> equal_range( const key_type& x );
80 iterator_range<const_iterator> equal_range( const key_type& x ) const;
82 }; // class 'associative_ptr_container'
84 } // namespace 'boost'
95 - ``typedef ... key_type;``
97 - if we are dealing with a map, then simply the key type
98 - if we are dealing with a set, then the *indirected* key type, that is,
99 given ``ptr_set<T>``, ``key_type*`` will be ``T*``.
101 - ``typedef ... key_compare;``
103 - comparison object type that determines the order of elements in the container
105 - ``typedef ... value_compare;``
107 - comparison object type that determines the order of elements in the container
108 - if we are dealing with a map, then this comparison simply forwards to the ``key_compare`` comparison operation
115 - ``key_compare key_comp() const;``
116 - ``value_compare value_comp() const;``
118 - returns copies of objects used to determine the order of elements
125 - ``template< typename InputIterator >
126 void insert( InputIterator first, InputIterator last );``
128 - Requirements: ``[first,last)`` is a valid range
130 - Effects: Inserts a cloned range
132 - Exception safety: Basic guarantee
134 - ``template< class InputRange >
135 void insert( const InputRange& r );``
137 - Effects: ``insert( boost::begin(r), boost::end(r) );``
139 - ``void erase( iterator position );``
141 - Requirements: ``position`` is a valid iterator from the container
143 - Effects: Removes the element defined by ``position``.
147 - ``size_type erase( const key_type& x );``
149 - Effects: Removes all the elements in the container with a key equivalent to ``x`` and returns the number of erased elements.
153 - ``void erase( iterator first, iterator last );``
155 - Requirements: ``[first,last)`` is a valid range
157 - Effects: Removes the range of elements defined by ``[first,last)``.
161 - ``template< class Range > void erase( const Range& r );``
163 - Effects: ``erase( boost::begin(r), boost::end(r) );``
167 Semantics: algorithms
168 ^^^^^^^^^^^^^^^^^^^^^
170 - ``iterator find( const Key& x );``
171 - ``const_iterator find( const Key& x ) const;``
173 - Effects: Searches for the key and returns ``end()`` on failure.
175 - Complexity: Logarithmic
177 - ``size_type count( const Key& x ) const;``
179 - Effects: Counts the elements with a key equivalent to ``x``
181 - Complexity: Logarithmic
183 - ``iterator lower_bound( const Key& x );``
184 - ``const_iterator lower_bound( const Key& x ) const;``
186 - Effects: Returns an iterator pointing to the first element with a key not less than ``x``
188 - Complexity: Logarithmic
190 - ``iterator upper_bound( const Key& x );``
191 - ``const_iterator upper_bound( const Key& x ) const;``
193 - Effects: Returns an iterator pointing to the first element with a key greater than ``x``
195 - Complexity: Logarithmic
197 - ``iterator_range<iterator> equal_range( const Key& x );``
198 - ``iterator_range<const_iterator> equal_range( const Key& x ) const;``
200 - Effects: ``return boost::make_iterator_range( lower_bound( x ), upper_bound( x ) );``
202 - Complexity: Logarithmic
205 - ``reference at( const key_type& key );``
206 - ``const_reference at( const key_type& key ) const;``
208 - Requirements: the key exists
210 - Effects: returns the object with key ``key``
212 - Throws: ``bad_ptr_container_operation`` if the key does not exist
215 .. _`pointer container requirements`:
221 :Copyright: Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt__).
223 __ http://www.boost.org/LICENSE_1_0.txt