• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Class template any_base_hook</title>
6<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../../intrusive/reference.html#header.boost.intrusive.any_hook_hpp" title="Header &lt;boost/intrusive/any_hook.hpp&gt;">
10<link rel="prev" href="../../intrusive/reference.html" title="Reference">
11<link rel="next" href="any_member_hook.html" title="Class template any_member_hook">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
16<td align="center"><a href="../../../../index.html">Home</a></td>
17<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="../../intrusive/reference.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../intrusive/reference.html#header.boost.intrusive.any_hook_hpp"><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="any_member_hook.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="boost.intrusive.any_base_hook"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Class template any_base_hook</span></h2>
30<p>boost::intrusive::any_base_hook</p>
31</div>
32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../intrusive/reference.html#header.boost.intrusive.any_hook_hpp" title="Header &lt;boost/intrusive/any_hook.hpp&gt;">boost/intrusive/any_hook.hpp</a>&gt;
34
35</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span> Options<span class="special">&gt;</span>
36<span class="keyword">class</span> <a class="link" href="any_base_hook.html" title="Class template any_base_hook">any_base_hook</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">make_any_base_hook</span><span class="special">::</span><span class="identifier">type</span><span class="special">&lt;</span> <span class="identifier">O1</span><span class="special">,</span> <span class="identifier">O2</span><span class="special">,</span> <span class="identifier">O3</span> <span class="special">&gt;</span> <span class="special">{</span>
37<span class="keyword">public</span><span class="special">:</span>
38  <span class="comment">// <a class="link" href="any_base_hook.html#boost.intrusive.any_base_hookconstruct-copy-destruct">construct/copy/destruct</a></span>
39  <a class="link" href="any_base_hook.html#idm45020933276464-bb"><span class="identifier">any_base_hook</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
40  <a class="link" href="any_base_hook.html#idm45020933273200-bb"><span class="identifier">any_base_hook</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any_base_hook.html" title="Class template any_base_hook">any_base_hook</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
41  <a class="link" href="any_base_hook.html" title="Class template any_base_hook">any_base_hook</a> <span class="special">&amp;</span> <a class="link" href="any_base_hook.html#idm45020961312640-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any_base_hook.html" title="Class template any_base_hook">any_base_hook</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
42  <a class="link" href="any_base_hook.html#idm45020961307472-bb"><span class="special">~</span><span class="identifier">any_base_hook</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
43
44  <span class="comment">// <a class="link" href="any_base_hook.html#idm45020933282704-bb">public member functions</a></span>
45  <span class="keyword">bool</span> <a class="link" href="any_base_hook.html#idm45020933282144-bb"><span class="identifier">is_linked</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
46<span class="special">}</span><span class="special">;</span></pre></div>
47<div class="refsect1">
48<a name="id-1.3.20.42.2.3.4"></a><h2>Description</h2>
49<p>Derive a class from this hook in order to store objects of that class in an intrusive container.</p>
50<p>The hook admits the following options: <code class="computeroutput">tag&lt;&gt;</code>, <code class="computeroutput">void_pointer&lt;&gt;</code> and <code class="computeroutput">link_mode&lt;&gt;</code>.</p>
51<p><code class="computeroutput">tag&lt;&gt;</code> defines a tag to identify the node. The same tag value can be used in different classes, but if a class is derived from more than one <code class="computeroutput"><a class="link" href="any_base_hook.html" title="Class template any_base_hook">any_base_hook</a></code>, then each <code class="computeroutput"><a class="link" href="any_base_hook.html" title="Class template any_base_hook">any_base_hook</a></code> needs its unique tag.</p>
52<p><code class="computeroutput">link_mode&lt;&gt;</code> will specify the linking mode of the hook (<code class="computeroutput">normal_link</code>, <code class="computeroutput">safe_link</code>).</p>
53<p><code class="computeroutput">void_pointer&lt;&gt;</code> is the pointer type that will be used internally in the hook and the container configured to use this hook. </p>
54<div class="refsect2">
55<a name="id-1.3.20.42.2.3.4.7"></a><h3>
56<a name="boost.intrusive.any_base_hookconstruct-copy-destruct"></a><code class="computeroutput">any_base_hook</code>
57        public
58       construct/copy/destruct</h3>
59<div class="orderedlist"><ol class="orderedlist" type="1">
60<li class="listitem">
61<pre class="literallayout"><a name="idm45020933276464-bb"></a><span class="identifier">any_base_hook</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
62<p><span class="bold"><strong>Effects</strong></span>: If <code class="computeroutput"><a class="link" href="link_mode.html" title="Struct template link_mode">link_mode</a></code> is or <code class="computeroutput">safe_link</code> initializes the node to an unlinked state.</p>
63<p><span class="bold"><strong>Throws</strong></span>: Nothing. </p>
64</li>
65<li class="listitem">
66<pre class="literallayout"><a name="idm45020933273200-bb"></a><span class="identifier">any_base_hook</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any_base_hook.html" title="Class template any_base_hook">any_base_hook</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>
67<p><span class="bold"><strong>Effects</strong></span>: If <code class="computeroutput"><a class="link" href="link_mode.html" title="Struct template link_mode">link_mode</a></code> is or <code class="computeroutput">safe_link</code> initializes the node to an unlinked state. The argument is ignored.</p>
68<p><span class="bold"><strong>Throws</strong></span>: Nothing.</p>
69<p><span class="bold"><strong>Rationale</strong></span>: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. <code class="computeroutput">swap</code> can be used to emulate move-semantics. </p>
70</li>
71<li class="listitem">
72<pre class="literallayout"><a class="link" href="any_base_hook.html" title="Class template any_base_hook">any_base_hook</a> <span class="special">&amp;</span> <a name="idm45020961312640-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any_base_hook.html" title="Class template any_base_hook">any_base_hook</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>
73<p><span class="bold"><strong>Effects</strong></span>: Empty function. The argument is ignored.</p>
74<p><span class="bold"><strong>Throws</strong></span>: Nothing.</p>
75<p><span class="bold"><strong>Rationale</strong></span>: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. <code class="computeroutput">swap</code> can be used to emulate move-semantics. </p>
76</li>
77<li class="listitem">
78<pre class="literallayout"><a name="idm45020961307472-bb"></a><span class="special">~</span><span class="identifier">any_base_hook</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
79<p><span class="bold"><strong>Effects</strong></span>: If <code class="computeroutput"><a class="link" href="link_mode.html" title="Struct template link_mode">link_mode</a></code> is <code class="computeroutput">normal_link</code>, the destructor does nothing (ie. no code is generated). If <code class="computeroutput"><a class="link" href="link_mode.html" title="Struct template link_mode">link_mode</a></code> is <code class="computeroutput">safe_link</code> and the object is stored in a container an assertion is raised.</p>
80<p><span class="bold"><strong>Throws</strong></span>: Nothing. </p>
81</li>
82</ol></div>
83</div>
84<div class="refsect2">
85<a name="id-1.3.20.42.2.3.4.8"></a><h3>
86<a name="idm45020933282704-bb"></a><code class="computeroutput">any_base_hook</code> public member functions</h3>
87<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
88<pre class="literallayout"><span class="keyword">bool</span> <a name="idm45020933282144-bb"></a><span class="identifier">is_linked</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
89<p><span class="bold"><strong>Precondition</strong></span>: <code class="computeroutput"><a class="link" href="link_mode.html" title="Struct template link_mode">link_mode</a></code> must be <code class="computeroutput">safe_link</code>.</p>
90<p><span class="bold"><strong>Returns</strong></span>: true, if the node belongs to a container, false otherwise. This function can be used to test whether <code class="computeroutput">container::iterator_to</code> will return a valid iterator.</p>
91<p><span class="bold"><strong>Complexity</strong></span>: Constant </p>
92</li></ol></div>
93</div>
94</div>
95</div>
96<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
97<td align="left"></td>
98<td align="right"><div class="copyright-footer">Copyright © 2005 Olaf Krzikalla<br>Copyright © 2006-2015 Ion Gaztanaga<p>
99        Distributed under the Boost Software License, Version 1.0. (See accompanying
100        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>)
101      </p>
102</div></td>
103</tr></table>
104<hr>
105<div class="spirit-nav">
106<a accesskey="p" href="../../intrusive/reference.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../intrusive/reference.html#header.boost.intrusive.any_hook_hpp"><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="any_member_hook.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
107</div>
108</body>
109</html>
110