1 <?xml version="1.0" encoding="utf-8" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
7 <title>Boost Pointer Container Library</title>
8 <style type="text/css">
11 :Author: David Goodger
12 :Contact: goodger@users.sourceforge.net
13 :Date: $Date: 2006-11-22 14:01:03 -0800 (Wed, 22 Nov 2006) $
14 :Revision: $Revision: 36152 $
15 :Copyright: This stylesheet has been placed in the public domain.
17 Default cascading style sheet for the HTML output of Docutils.
19 See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
20 customize this style sheet.
23 /* "! important" is used here to override other ``margin-top`` and
24 ``margin-bottom`` styles that are later in the stylesheet or
25 more specific. See http://www.w3.org/TR/CSS1#the-cascade */
27 margin-top: 0 ! important }
29 .last, .with-subtitle {
30 margin-bottom: 0 ! important }
36 text-decoration: none ;
43 margin-bottom: 0.5em }
45 /* Uncomment (and remove this text!) to get bold-faced definition list terms
53 div.abstract p.topic-title {
57 div.admonition, div.attention, div.caution, div.danger, div.error,
58 div.hint, div.important, div.note, div.tip, div.warning {
60 border: medium outset ;
63 div.admonition p.admonition-title, div.hint p.admonition-title,
64 div.important p.admonition-title, div.note p.admonition-title,
65 div.tip p.admonition-title {
67 font-family: sans-serif }
69 div.attention p.admonition-title, div.caution p.admonition-title,
70 div.danger p.admonition-title, div.error p.admonition-title,
71 div.warning p.admonition-title {
74 font-family: sans-serif }
76 /* Uncomment (and remove this text!) to get reduced vertical space in
78 div.compound .compound-first, div.compound .compound-middle {
79 margin-bottom: 0.5em }
81 div.compound .compound-last, div.compound .compound-middle {
90 div.dedication p.topic-title {
97 div.footer, div.header {
106 div.line-block div.line-block {
113 border: medium outset ;
115 background-color: #ffffee ;
120 div.sidebar p.rubric {
121 font-family: sans-serif ;
124 div.system-messages {
127 div.system-messages h1 {
131 border: medium outset ;
134 div.system-message p.system-message-title {
141 h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
142 h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
163 ol.simple, ul.simple {
167 list-style: decimal }
170 list-style: lower-alpha }
173 list-style: upper-alpha }
176 list-style: lower-roman }
179 list-style: upper-roman }
193 white-space: nowrap }
202 font-family: sans-serif ;
207 font-family: sans-serif ;
223 pre.literal-block, pre.doctest-block {
226 background-color: #eeeeee }
229 font-family: sans-serif ;
230 font-style: oblique }
232 span.classifier-delimiter {
233 font-family: sans-serif ;
237 font-family: sans-serif }
240 white-space: nowrap }
248 span.section-subtitle {
249 /* font-size relative to parent (h1..h6 element) */
253 border-left: solid thin gray }
260 margin-bottom: 0.5em }
263 border-left: solid thin black }
265 table.docutils td, table.docutils th,
266 table.docinfo td, table.docinfo th {
267 padding-left: 0.5em ;
268 padding-right: 0.5em ;
269 vertical-align: top }
271 table.docutils th.field-name, table.docinfo th.docinfo-name {
274 white-space: nowrap ;
277 h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
278 h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
282 background-color: #eeeeee }
285 list-style-type: none }
290 <div class="document" id="boost-pointer-container-library">
291 <h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
292 <div class="section">
293 <h1><a id="class-associative-ptr-container" name="class-associative-ptr-container">Class <tt class="docutils literal"><span class="pre">associative_ptr_container</span></tt></a></h1>
294 <p>This section describes all the common operations for all associative
295 pointer containers (in addition to <tt class="docutils literal"><span class="pre">reversible_ptr_container</span></tt>).</p>
296 <p><strong>Hierarchy:</strong></p>
298 <li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
299 <li><tt class="docutils literal"><span class="pre">associative_ptr_container</span></tt><ul>
300 <li><a class="reference" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
301 <li><a class="reference" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
302 <li><a class="reference" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
303 <li><a class="reference" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
304 <li><a class="reference" href="ptr_set.html">ptr_set</a></li>
305 <li><a class="reference" href="ptr_multiset.html">ptr_multi_set</a></li>
306 <li><a class="reference" href="ptr_map.html">ptr_map</a></li>
307 <li><a class="reference" href="ptr_multimap.html">ptr_multimap</a></li>
315 <p><strong>See also:</strong></p>
317 <li><a class="reference" href="http://www.boost.org/libs/range/doc/utility_class.html#iter_range">iterator_range</a></li>
319 <p><strong>Navigate:</strong></p>
321 <li><a class="reference" href="ptr_container.html">home</a></li>
322 <li><a class="reference" href="reference.html">reference</a></li>
324 <p><strong>Synopsis:</strong></p>
325 <pre class="literal-block">
331 class CloneAllocator = heap_clone_allocator
333 class associative_ptr_container
335 public: // <a class="reference" href="#typedefs">typedefs</a>
336 typedef ... key_type;
337 typedef ... key_compare;
338 typedef ... value_compare;
340 public: // <a class="reference" href="#observers">observers</a>
341 key_compare key_comp() const;
342 value_compare value_comp() const;
344 public: // <a class="reference" href="#modifiers">modifiers</a>
345 template< typename InputIterator >
346 void insert( InputIterator first, InputIterator last );
347 template< class InputRange >
348 void insert( const InputRange& r );
349 void erase( iterator position );
350 size_type erase( const key_type& x );
351 template< class Range >
352 void erase( const Range& r );
353 void erase( iterator first, iterator last );
355 public: // <a class="reference" href="#algorithms">algorithms</a>
356 iterator find( const key_type& x );
357 const_iterator find( const key_type& x ) const;
358 size_type count( const key_type& x ) const;
359 iterator lower_bound( const key_type& x );
360 const_iterator lower_bound( const key_type& x ) const;
361 iterator upper_bound( const key_type& x );
362 const_iterator upper_bound( const key_type& x ) const;
363 iterator_range<iterator> equal_range( const key_type& x );
364 iterator_range<const_iterator> equal_range( const key_type& x ) const;
366 }; // class 'associative_ptr_container'
368 } // namespace 'boost'
371 <div class="section">
372 <h1><a id="semantics" name="semantics">Semantics</a></h1>
373 <div class="section">
374 <h2><a id="semantics-typedefs" name="semantics-typedefs"><span id="typedefs"></span>Semantics: typedefs</a></h2>
376 <li><p class="first"><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">...</span> <span class="pre">key_type;</span></tt></p>
379 <li>if we are dealing with a map, then simply the key type</li>
380 <li>if we are dealing with a set, then the <em>indirected</em> key type, that is,
381 given <tt class="docutils literal"><span class="pre">ptr_set<T></span></tt>, <tt class="docutils literal"><span class="pre">key_type*</span></tt> will be <tt class="docutils literal"><span class="pre">T*</span></tt>.</li>
385 <li><p class="first"><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">...</span> <span class="pre">key_compare;</span></tt></p>
388 <li>comparison object type that determines the order of elements in the container</li>
392 <li><p class="first"><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">...</span> <span class="pre">value_compare;</span></tt></p>
395 <li>comparison object type that determines the order of elements in the container</li>
396 <li>if we are dealing with a map, then this comparison simply forwards to the <tt class="docutils literal"><span class="pre">key_compare</span></tt> comparison operation</li>
402 <div class="section">
403 <h2><a id="semantics-observers" name="semantics-observers"><span id="observers"></span>Semantics: observers</a></h2>
405 <li><p class="first"><tt class="docutils literal"><span class="pre">key_compare</span> <span class="pre">key_comp()</span> <span class="pre">const;</span></tt></p>
407 <li><p class="first"><tt class="docutils literal"><span class="pre">value_compare</span> <span class="pre">value_comp()</span> <span class="pre">const;</span></tt></p>
410 <li>returns copies of objects used to determine the order of elements</li>
416 <div class="section">
417 <h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
419 <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">typename</span> <span class="pre">InputIterator</span> <span class="pre">></span>
420 <span class="pre">void</span> <span class="pre">insert(</span> <span class="pre">InputIterator</span> <span class="pre">first,</span> <span class="pre">InputIterator</span> <span class="pre">last</span> <span class="pre">);</span></tt></p>
423 <li>Requirements: <tt class="docutils literal"><span class="pre">[first,last)</span></tt> is a valid range</li>
424 <li>Effects: Inserts a cloned range</li>
425 <li>Exception safety: Basic guarantee</li>
429 <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">class</span> <span class="pre">InputRange</span> <span class="pre">></span>
430 <span class="pre">void</span> <span class="pre">insert(</span> <span class="pre">const</span> <span class="pre">InputRange&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
433 <li>Effects: <tt class="docutils literal"><span class="pre">insert(</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r)</span> <span class="pre">);</span></tt></li>
437 <li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">erase(</span> <span class="pre">iterator</span> <span class="pre">position</span> <span class="pre">);</span></tt></p>
440 <li>Requirements: <tt class="docutils literal"><span class="pre">position</span></tt> is a valid iterator from the container</li>
441 <li>Effects: Removes the element defined by <tt class="docutils literal"><span class="pre">position</span></tt>.</li>
442 <li>Throws: Nothing</li>
446 <li><p class="first"><tt class="docutils literal"><span class="pre">size_type</span> <span class="pre">erase(</span> <span class="pre">const</span> <span class="pre">key_type&</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
449 <li>Effects: Removes all the elements in the container with a key equivalent to <tt class="docutils literal"><span class="pre">x</span></tt> and returns the number of erased elements.</li>
450 <li>Throws: Nothing</li>
454 <li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">erase(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last</span> <span class="pre">);</span></tt></p>
457 <li>Requirements: <tt class="docutils literal"><span class="pre">[first,last)</span></tt> is a valid range</li>
458 <li>Effects: Removes the range of elements defined by <tt class="docutils literal"><span class="pre">[first,last)</span></tt>.</li>
459 <li>Throws: Nothing</li>
463 <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">class</span> <span class="pre">Range</span> <span class="pre">></span> <span class="pre">void</span> <span class="pre">erase(</span> <span class="pre">const</span> <span class="pre">Range&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
466 <li>Effects: <tt class="docutils literal"><span class="pre">erase(</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r)</span> <span class="pre">);</span></tt></li>
472 <div class="section">
473 <h2><a id="semantics-algorithms" name="semantics-algorithms"><span id="algorithms"></span>Semantics: algorithms</a></h2>
475 <li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">find(</span> <span class="pre">const</span> <span class="pre">Key&</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
477 <li><p class="first"><tt class="docutils literal"><span class="pre">const_iterator</span> <span class="pre">find(</span> <span class="pre">const</span> <span class="pre">Key&</span> <span class="pre">x</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
480 <li>Effects: Searches for the key and returns <tt class="docutils literal"><span class="pre">end()</span></tt> on failure.</li>
481 <li>Complexity: Logarithmic</li>
485 <li><p class="first"><tt class="docutils literal"><span class="pre">size_type</span> <span class="pre">count(</span> <span class="pre">const</span> <span class="pre">Key&</span> <span class="pre">x</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
488 <li>Effects: Counts the elements with a key equivalent to <tt class="docutils literal"><span class="pre">x</span></tt></li>
489 <li>Complexity: Logarithmic</li>
493 <li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">lower_bound(</span> <span class="pre">const</span> <span class="pre">Key&</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
495 <li><p class="first"><tt class="docutils literal"><span class="pre">const_iterator</span> <span class="pre">lower_bound(</span> <span class="pre">const</span> <span class="pre">Key&</span> <span class="pre">x</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
498 <li>Effects: Returns an iterator pointing to the first element with a key not less than <tt class="docutils literal"><span class="pre">x</span></tt></li>
499 <li>Complexity: Logarithmic</li>
503 <li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">upper_bound(</span> <span class="pre">const</span> <span class="pre">Key&</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
505 <li><p class="first"><tt class="docutils literal"><span class="pre">const_iterator</span> <span class="pre">upper_bound(</span> <span class="pre">const</span> <span class="pre">Key&</span> <span class="pre">x</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
508 <li>Effects: Returns an iterator pointing to the first element with a key greater than <tt class="docutils literal"><span class="pre">x</span></tt></li>
509 <li>Complexity: Logarithmic</li>
513 <li><p class="first"><tt class="docutils literal"><span class="pre">iterator_range<iterator></span> <span class="pre">equal_range(</span> <span class="pre">const</span> <span class="pre">Key&</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
515 <li><p class="first"><tt class="docutils literal"><span class="pre">iterator_range<const_iterator></span> <span class="pre">equal_range(</span> <span class="pre">const</span> <span class="pre">Key&</span> <span class="pre">x</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
518 <li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">boost::make_iterator_range(</span> <span class="pre">lower_bound(</span> <span class="pre">x</span> <span class="pre">),</span> <span class="pre">upper_bound(</span> <span class="pre">x</span> <span class="pre">)</span> <span class="pre">);</span></tt></li>
519 <li>Complexity: Logarithmic</li>
524 <!-- - ``reference at( const key_type& key );``
525 - ``const_reference at( const key_type& key ) const;``
527 - Requirements: the key exists
529 - Effects: returns the object with key ``key``
531 - Throws: ``bad_ptr_container_operation`` if the key does not exist -->
532 <hr><table class="docutils field-list" frame="void" rules="none">
533 <col class="field-name" />
534 <col class="field-body" />
536 <tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>