72 lines
5.9 KiB
HTML
72 lines
5.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title>Stability and insertion with hint in ordered associative containers with equivalent keys</title>
|
||
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
|
||
<link rel="up" href="../intrusive.html" title="Chapter 19. Boost.Intrusive">
|
||
<link rel="prev" href="boost_intrusive_iterators.html" title="Boost.Intrusive Iterator features">
|
||
<link rel="next" href="obtaining_same_type_reducing_space.html" title="Obtaining the same types and reducing symbol length">
|
||
</head>
|
||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||
<table cellpadding="2" width="100%"><tr>
|
||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
|
||
<td align="center"><a href="../../../index.html">Home</a></td>
|
||
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
|
||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||
<td align="center"><a href="../../../more/index.htm">More</a></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<a accesskey="p" href="boost_intrusive_iterators.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../intrusive.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="obtaining_same_type_reducing_space.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||
<a name="intrusive.equal_range_stability"></a><a class="link" href="equal_range_stability.html" title="Stability and insertion with hint in ordered associative containers with equivalent keys">Stability and insertion
|
||
with hint in ordered associative containers with equivalent keys</a>
|
||
</h2></div></div></div>
|
||
<p>
|
||
<span class="bold"><strong>Boost.Intrusive</strong></span> ordered associative containers
|
||
with equivalent keys offer stability guarantees, following <a href="http://open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#233" target="_top">C++
|
||
standard library's defect #233 resolution</a>, explained in document <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1780.html" target="_top">Comments
|
||
on LWG issue 233: Insertion hints in associative containers</a>. This means
|
||
that:
|
||
</p>
|
||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||
<li class="listitem">
|
||
A <span class="emphasis"><em>Insert without hint</em></span> member function always insert
|
||
at the upper bound of an equal range.
|
||
</li>
|
||
<li class="listitem">
|
||
A <span class="emphasis"><em>Insert with hint</em></span> member function inserts the new
|
||
value <span class="bold"><strong>before the hint</strong></span> if hint's and new
|
||
node's keys are equivalent.
|
||
</li>
|
||
<li class="listitem">
|
||
Implements Andrew Koenig <span class="emphasis"><em>as close as possible to hint</em></span>
|
||
proposal. A new element is always be inserted as close to the hint as possible.
|
||
So, for example, if there is a subsequence of equivalent values, <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span></code> as the hint means that the new element
|
||
should be inserted before the subsequence even if <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span></code> is far away. This allows code to always
|
||
append (or prepend) an equal range with something as simple as: <code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">m</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">new_node</span><span class="special">);</span></code>
|
||
or <code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">m</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">new_node</span><span class="special">);</span></code>
|
||
</li>
|
||
</ul></div>
|
||
</div>
|
||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||
<td align="left"></td>
|
||
<td align="right"><div class="copyright-footer">Copyright © 2005 Olaf Krzikalla<br>Copyright © 2006-2015 Ion Gaztanaga<p>
|
||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||
</p>
|
||
</div></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<a accesskey="p" href="boost_intrusive_iterators.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../intrusive.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="obtaining_same_type_reducing_space.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
|
||
</div>
|
||
</body>
|
||
</html>
|