3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Class attribute_set</title>
5 <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../index.html" title="Chapter 1. Boost.Log v2">
8 <link rel="up" href="../../attributes.html#header.boost.log.attributes.attribute_set_hpp" title="Header <boost/log/attributes/attribute_set.hpp>">
9 <link rel="prev" href="operator_idm45711349235344.html" title="Function template operator<<">
10 <link rel="next" href="swap_idm45711349124800.html" title="Function swap">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td></tr></table>
15 <div class="spirit-nav">
16 <a accesskey="p" href="operator_idm45711349235344.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../attributes.html#header.boost.log.attributes.attribute_set_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="swap_idm45711349124800.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
18 <div class="refentry">
19 <a name="boost.log.attribute_set"></a><div class="titlepage"></div>
20 <div class="refnamediv">
21 <h2><span class="refentrytitle">Class attribute_set</span></h2>
22 <p>boost::log::attribute_set — An attribute set class. </p>
24 <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
25 <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../attributes.html#header.boost.log.attributes.attribute_set_hpp" title="Header <boost/log/attributes/attribute_set.hpp>">boost/log/attributes/attribute_set.hpp</a>>
28 <span class="keyword">class</span> <a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> <span class="special">{</span>
29 <span class="keyword">public</span><span class="special">:</span>
30 <span class="comment">// <a class="link" href="attribute_set.html#boost.log.attribute_settypes">types</a></span>
31 <span class="keyword">typedef</span> <a class="link" href="attribute_name.html" title="Class attribute_name">attribute_name</a> <a name="boost.log.attribute_set.key_type"></a><span class="identifier">key_type</span><span class="special">;</span> <span class="comment">// Key type. </span>
32 <span class="keyword">typedef</span> <a class="link" href="attribute.html" title="Class attribute">attribute</a> <a name="boost.log.attribute_set.mapped_type"></a><span class="identifier">mapped_type</span><span class="special">;</span> <span class="comment">// Mapped attribute type. </span>
33 <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span> <span class="keyword">const</span> <span class="identifier">key_type</span><span class="special">,</span> <span class="identifier">mapped_type</span> <span class="special">></span> <a name="boost.log.attribute_set.value_type"></a><span class="identifier">value_type</span><span class="special">;</span> <span class="comment">// Value type. </span>
34 <span class="keyword">typedef</span> <span class="identifier">value_type</span> <span class="special">&</span> <a name="boost.log.attribute_set.reference"></a><span class="identifier">reference</span><span class="special">;</span> <span class="comment">// Reference type. </span>
35 <span class="keyword">typedef</span> <span class="identifier">value_type</span> <span class="keyword">const</span> <span class="special">&</span> <a name="boost.log.attribute_set.const_reference"></a><span class="identifier">const_reference</span><span class="special">;</span> <span class="comment">// Const reference type. </span>
36 <span class="keyword">typedef</span> <span class="identifier">value_type</span> <span class="special">*</span> <a name="boost.log.attribute_set.pointer"></a><span class="identifier">pointer</span><span class="special">;</span> <span class="comment">// Pointer type. </span>
37 <span class="keyword">typedef</span> <span class="identifier">value_type</span> <span class="keyword">const</span> <span class="special">*</span> <a name="boost.log.attribute_set.const_pointer"></a><span class="identifier">const_pointer</span><span class="special">;</span> <span class="comment">// Const pointer type. </span>
38 <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <a name="boost.log.attribute_set.size_type"></a><span class="identifier">size_type</span><span class="special">;</span> <span class="comment">// Size type. </span>
39 <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ptrdiff_t</span> <a name="boost.log.attribute_set.difference_type"></a><span class="identifier">difference_type</span><span class="special">;</span> <span class="comment">// Difference type. </span>
40 <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span> <a class="link" href="attribute_set.html#boost.log.attribute_set.iterator"><span class="identifier">iterator</span></a><span class="special">;</span>
41 <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span> <a class="link" href="attribute_set.html#boost.log.attribute_set.const_iterator"><span class="identifier">const_iterator</span></a><span class="special">;</span>
43 <span class="comment">// <a class="link" href="attribute_set.html#boost.log.attribute_setconstruct-copy-destruct">construct/copy/destruct</a></span>
44 <a class="link" href="attribute_set.html#idm45711349136032-bb"><span class="identifier">attribute_set</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
45 <a class="link" href="attribute_set.html#idm45711349134176-bb"><span class="identifier">attribute_set</span></a><span class="special">(</span><a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
46 <a class="link" href="attribute_set.html#idm45711349131280-bb"><span class="identifier">attribute_set</span></a><span class="special">(</span><a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> <span class="special">&&</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
47 <a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> <span class="special">&</span> <a class="link" href="attribute_set.html#idm45711349128576-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
48 <a class="link" href="attribute_set.html#idm45711349129328-bb"><span class="special">~</span><span class="identifier">attribute_set</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
50 <span class="comment">// <a class="link" href="attribute_set.html#idm45711349211216-bb">public member functions</a></span>
51 <span class="keyword">void</span> <a class="link" href="attribute_set.html#idm45711349210656-bb"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> <span class="special">&</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
52 <span class="identifier">iterator</span> <a class="link" href="attribute_set.html#idm45711349207280-bb"><span class="identifier">begin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
53 <span class="identifier">iterator</span> <a class="link" href="attribute_set.html#idm45711349205136-bb"><span class="identifier">end</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
54 <span class="identifier">const_iterator</span> <a class="link" href="attribute_set.html#idm45711349202976-bb"><span class="identifier">begin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
55 <span class="identifier">const_iterator</span> <a class="link" href="attribute_set.html#idm45711349200816-bb"><span class="identifier">end</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
56 <span class="identifier">size_type</span> <a class="link" href="attribute_set.html#idm45711349198656-bb"><span class="identifier">size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
57 <span class="keyword">bool</span> <a class="link" href="attribute_set.html#idm45711349196528-bb"><span class="identifier">empty</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
58 <span class="identifier">iterator</span> <a class="link" href="attribute_set.html#idm45711349194368-bb"><span class="identifier">find</span></a><span class="special">(</span><span class="identifier">key_type</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
59 <span class="identifier">const_iterator</span> <a class="link" href="attribute_set.html#idm45711349190784-bb"><span class="identifier">find</span></a><span class="special">(</span><span class="identifier">key_type</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
60 <span class="identifier">size_type</span> <a class="link" href="attribute_set.html#idm45711349186768-bb"><span class="identifier">count</span></a><span class="special">(</span><span class="identifier">key_type</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
61 <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <a class="link" href="attribute_set.html#idm45711349183056-bb"><span class="keyword">operator</span><span class="special">[</span><span class="special">]</span></a><span class="special">(</span><span class="identifier">key_type</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
62 <span class="identifier">mapped_type</span> <a class="link" href="attribute_set.html#idm45711349176256-bb"><span class="keyword">operator</span><span class="special">[</span><span class="special">]</span></a><span class="special">(</span><span class="identifier">key_type</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
63 <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">></span> <a class="link" href="attribute_set.html#idm45711349172608-bb"><span class="identifier">insert</span></a><span class="special">(</span><span class="identifier">key_type</span><span class="special">,</span> <span class="identifier">mapped_type</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
64 <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">></span> <a class="link" href="attribute_set.html#idm45711349168048-bb"><span class="identifier">insert</span></a><span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span><span class="special">;</span>
65 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> FwdIteratorT<span class="special">></span> <span class="keyword">void</span> <a class="link" href="attribute_set.html#idm45711349164608-bb"><span class="identifier">insert</span></a><span class="special">(</span><span class="identifier">FwdIteratorT</span><span class="special">,</span> <span class="identifier">FwdIteratorT</span><span class="special">)</span><span class="special">;</span>
66 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> FwdIteratorT<span class="special">,</span> <span class="keyword">typename</span> OutputIteratorT<span class="special">></span>
67 <span class="keyword">void</span> <a class="link" href="attribute_set.html#idm45711349159888-bb"><span class="identifier">insert</span></a><span class="special">(</span><span class="identifier">FwdIteratorT</span><span class="special">,</span> <span class="identifier">FwdIteratorT</span><span class="special">,</span> <span class="identifier">OutputIteratorT</span><span class="special">)</span><span class="special">;</span>
68 <span class="identifier">size_type</span> <a class="link" href="attribute_set.html#idm45711349153392-bb"><span class="identifier">erase</span></a><span class="special">(</span><span class="identifier">key_type</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
69 <span class="keyword">void</span> <a class="link" href="attribute_set.html#idm45711349149216-bb"><span class="identifier">erase</span></a><span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
70 <span class="keyword">void</span> <a class="link" href="attribute_set.html#idm45711349145024-bb"><span class="identifier">erase</span></a><span class="special">(</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
71 <span class="keyword">void</span> <a class="link" href="attribute_set.html#idm45711349138912-bb"><span class="identifier">clear</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
72 <span class="special">}</span><span class="special">;</span></pre></div>
73 <div class="refsect1">
74 <a name="idm45554754430704"></a><h2>Description</h2>
75 <p>An attribute set is an associative container with attribute name as a key and pointer to the attribute as a mapped value. The container allows storing only one element for each distinct key value. In most regards attribute set container provides interface similar to <code class="computeroutput">std::unordered_map</code>. However, there are differences in <code class="computeroutput">operator</code>[] semantics and a number of optimizations with regard to iteration. Besides, attribute names are stored as a read-only <code class="computeroutput"><a class="link" href="attribute_name.html" title="Class attribute_name">attribute_name</a></code>'s instead of <code class="computeroutput">std::string</code>, which saves memory and CPU time. </p>
76 <div class="refsect2">
77 <a name="idm45554754426176"></a><h3>
78 <a name="boost.log.attribute_settypes"></a><code class="computeroutput">attribute_set</code>
81 <div class="orderedlist"><ol class="orderedlist" type="1">
84 <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span> <a name="boost.log.attribute_set.iterator"></a><span class="identifier">iterator</span><span class="special">;</span></p>
85 <p>Iterator type. The iterator complies to the bidirectional iterator requirements. </p>
89 <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span> <a name="boost.log.attribute_set.const_iterator"></a><span class="identifier">const_iterator</span><span class="special">;</span></p>
90 <p>Constant iterator type. The iterator complies to the bidirectional iterator requirements with read-only capabilities. </p>
94 <div class="refsect2">
95 <a name="idm45554754416256"></a><h3>
96 <a name="boost.log.attribute_setconstruct-copy-destruct"></a><code class="computeroutput">attribute_set</code>
98 construct/copy/destruct</h3>
99 <div class="orderedlist"><ol class="orderedlist" type="1">
100 <li class="listitem">
101 <pre class="literallayout"><a name="idm45711349136032-bb"></a><span class="identifier">attribute_set</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
102 <p>Default constructor.</p>
105 <div class="variablelist"><table border="0" class="variablelist compact">
107 <col align="left" valign="top">
111 <td><p><span class="term">Postconditions:</span></p></td>
112 <td><p><code class="computeroutput">empty() == true</code> </p></td>
116 <li class="listitem">
117 <pre class="literallayout"><a name="idm45711349134176-bb"></a><span class="identifier">attribute_set</span><span class="special">(</span><a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> <span class="keyword">const</span> <span class="special">&</span> that<span class="special">)</span><span class="special">;</span></pre>
118 <p>Copy constructor.</p>
121 <div class="variablelist"><table border="0" class="variablelist compact">
123 <col align="left" valign="top">
127 <td><p><span class="term">Postconditions:</span></p></td>
128 <td><p><code class="computeroutput">size() == that.size() && std::equal(begin(), end(), that.begin()) == true</code> </p></td>
132 <li class="listitem">
133 <pre class="literallayout"><a name="idm45711349131280-bb"></a><span class="identifier">attribute_set</span><span class="special">(</span><a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> <span class="special">&&</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
134 <p>Move constructor </p>
136 <li class="listitem">
137 <pre class="literallayout"><a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> <span class="special">&</span> <a name="idm45711349128576-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
138 <p>Copy assignment operator.</p>
141 <div class="variablelist"><table border="0" class="variablelist compact">
143 <col align="left" valign="top">
147 <td><p><span class="term">Postconditions:</span></p></td>
148 <td><p><code class="computeroutput">size() == that.size() && std::equal(begin(), end(), that.begin()) == true</code> </p></td>
152 <li class="listitem">
153 <pre class="literallayout"><a name="idm45711349129328-bb"></a><span class="special">~</span><span class="identifier">attribute_set</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
154 <p>Destructor. All stored references to attributes are released. </p>
158 <div class="refsect2">
159 <a name="idm45554754378928"></a><h3>
160 <a name="idm45711349211216-bb"></a><code class="computeroutput">attribute_set</code> public member functions</h3>
161 <div class="orderedlist"><ol class="orderedlist" type="1">
162 <li class="listitem">
163 <pre class="literallayout"><span class="keyword">void</span> <a name="idm45711349210656-bb"></a><span class="identifier">swap</span><span class="special">(</span><a class="link" href="attribute_set.html" title="Class attribute_set">attribute_set</a> <span class="special">&</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
164 <p>Swaps two instances of the container.</p>
165 <p><span class="bold"><strong>Throws:</strong></span> Nothing. </p>
167 <li class="listitem">
168 <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45711349207280-bb"></a><span class="identifier">begin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
171 <div class="variablelist"><table border="0" class="variablelist compact">
173 <col align="left" valign="top">
177 <td><p><span class="term">Returns:</span></p></td>
178 <td><p>Iterator to the first element of the container. </p></td>
182 <li class="listitem">
183 <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45711349205136-bb"></a><span class="identifier">end</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
186 <div class="variablelist"><table border="0" class="variablelist compact">
188 <col align="left" valign="top">
192 <td><p><span class="term">Returns:</span></p></td>
193 <td><p>Iterator to the after-the-last element of the container. </p></td>
197 <li class="listitem">
198 <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45711349202976-bb"></a><span class="identifier">begin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
201 <div class="variablelist"><table border="0" class="variablelist compact">
203 <col align="left" valign="top">
207 <td><p><span class="term">Returns:</span></p></td>
208 <td><p>Constant iterator to the first element of the container. </p></td>
212 <li class="listitem">
213 <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45711349200816-bb"></a><span class="identifier">end</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
216 <div class="variablelist"><table border="0" class="variablelist compact">
218 <col align="left" valign="top">
222 <td><p><span class="term">Returns:</span></p></td>
223 <td><p>Constant iterator to the after-the-last element of the container. </p></td>
227 <li class="listitem">
228 <pre class="literallayout"><span class="identifier">size_type</span> <a name="idm45711349198656-bb"></a><span class="identifier">size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
231 <div class="variablelist"><table border="0" class="variablelist compact">
233 <col align="left" valign="top">
237 <td><p><span class="term">Returns:</span></p></td>
238 <td><p>Number of elements in the container. </p></td>
242 <li class="listitem">
243 <pre class="literallayout"><span class="keyword">bool</span> <a name="idm45711349196528-bb"></a><span class="identifier">empty</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
246 <div class="variablelist"><table border="0" class="variablelist compact">
248 <col align="left" valign="top">
252 <td><p><span class="term">Returns:</span></p></td>
253 <td><p>true if there are no elements in the container, false otherwise. </p></td>
257 <li class="listitem">
258 <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45711349194368-bb"></a><span class="identifier">find</span><span class="special">(</span><span class="identifier">key_type</span> key<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
259 <p>The method finds the attribute by name.</p>
263 <div class="variablelist"><table border="0" class="variablelist compact">
265 <col align="left" valign="top">
270 <td><p><span class="term">Parameters:</span></p></td>
271 <td><div class="variablelist"><table border="0" class="variablelist compact">
273 <col align="left" valign="top">
277 <td><p><span class="term"><code class="computeroutput">key</code></span></p></td>
278 <td><p>Attribute name. </p></td>
283 <td><p><span class="term">Returns:</span></p></td>
284 <td><p>Iterator to the found element or end() if the attribute with such name is not found. </p></td>
289 <li class="listitem">
290 <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45711349190784-bb"></a><span class="identifier">find</span><span class="special">(</span><span class="identifier">key_type</span> key<span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
291 <p>The method finds the attribute by name.</p>
295 <div class="variablelist"><table border="0" class="variablelist compact">
297 <col align="left" valign="top">
302 <td><p><span class="term">Parameters:</span></p></td>
303 <td><div class="variablelist"><table border="0" class="variablelist compact">
305 <col align="left" valign="top">
309 <td><p><span class="term"><code class="computeroutput">key</code></span></p></td>
310 <td><p>Attribute name. </p></td>
315 <td><p><span class="term">Returns:</span></p></td>
316 <td><p>Iterator to the found element or <code class="computeroutput">end()</code> if the attribute with such name is not found. </p></td>
321 <li class="listitem">
322 <pre class="literallayout"><span class="identifier">size_type</span> <a name="idm45711349186768-bb"></a><span class="identifier">count</span><span class="special">(</span><span class="identifier">key_type</span> key<span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
323 <p>The method counts the number of the attribute occurrences in the container. Since there can be only one attribute with a particular key, the method always return 0 or 1.</p>
327 <div class="variablelist"><table border="0" class="variablelist compact">
329 <col align="left" valign="top">
334 <td><p><span class="term">Parameters:</span></p></td>
335 <td><div class="variablelist"><table border="0" class="variablelist compact">
337 <col align="left" valign="top">
341 <td><p><span class="term"><code class="computeroutput">key</code></span></p></td>
342 <td><p>Attribute name. </p></td>
347 <td><p><span class="term">Returns:</span></p></td>
348 <td><p>The number of times the attribute is found in the container. </p></td>
353 <li class="listitem">
354 <pre class="literallayout"><span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <a name="idm45711349183056-bb"></a><span class="keyword">operator</span><span class="special">[</span><span class="special">]</span><span class="special">(</span><span class="identifier">key_type</span> key<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
355 <p>Combined lookup/insertion operator. The operator semantics depends on the further usage of the returned reference. </p>
356 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
357 <li class="listitem"><p>If the reference is used as an assignment target, the assignment expression is equivalent to element insertion, where the element is composed of the second argument of the <code class="computeroutput">operator</code>[] as a key and the second argument of assignment as a mapped value. </p></li>
358 <li class="listitem"><p>If the returned reference is used in context where a conversion to the mapped type is required, the result of the conversion is equivalent to the mapped value found with the second argument of the <code class="computeroutput">operator</code>[] as a key, if such an element exists in the container, or a default-constructed mapped value, if an element does not exist in the container.</p></li>
364 <div class="variablelist"><table border="0" class="variablelist compact">
366 <col align="left" valign="top">
371 <td><p><span class="term">Parameters:</span></p></td>
372 <td><div class="variablelist"><table border="0" class="variablelist compact">
374 <col align="left" valign="top">
378 <td><p><span class="term"><code class="computeroutput">key</code></span></p></td>
379 <td><p>Attribute name. </p></td>
384 <td><p><span class="term">Returns:</span></p></td>
385 <td><p>A smart reference object of unspecified type. </p></td>
390 <li class="listitem">
391 <pre class="literallayout"><span class="identifier">mapped_type</span> <a name="idm45711349176256-bb"></a><span class="keyword">operator</span><span class="special">[</span><span class="special">]</span><span class="special">(</span><span class="identifier">key_type</span> key<span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
392 <p>Lookup operator</p>
396 <div class="variablelist"><table border="0" class="variablelist compact">
398 <col align="left" valign="top">
403 <td><p><span class="term">Parameters:</span></p></td>
404 <td><div class="variablelist"><table border="0" class="variablelist compact">
406 <col align="left" valign="top">
410 <td><p><span class="term"><code class="computeroutput">key</code></span></p></td>
411 <td><p>Attribute name. </p></td>
416 <td><p><span class="term">Returns:</span></p></td>
417 <td><p>If an element with the corresponding attribute name is found in the container, its mapped value is returned. Otherwise a default-constructed mapped value is returned. </p></td>
422 <li class="listitem">
423 <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">></span> <a name="idm45711349172608-bb"></a><span class="identifier">insert</span><span class="special">(</span><span class="identifier">key_type</span> key<span class="special">,</span> <span class="identifier">mapped_type</span> <span class="keyword">const</span> <span class="special">&</span> data<span class="special">)</span><span class="special">;</span></pre>
424 <p>Insertion method</p>
428 <div class="variablelist"><table border="0" class="variablelist compact">
430 <col align="left" valign="top">
435 <td><p><span class="term">Parameters:</span></p></td>
436 <td><div class="variablelist"><table border="0" class="variablelist compact">
438 <col align="left" valign="top">
443 <td><p><span class="term"><code class="computeroutput">data</code></span></p></td>
444 <td><p>Pointer to the attribute. Must not be NULL. </p></td>
447 <td><p><span class="term"><code class="computeroutput">key</code></span></p></td>
448 <td><p>Attribute name. </p></td>
454 <td><p><span class="term">Returns:</span></p></td>
455 <td><p>A pair of values. If second is true, the insertion succeeded and the first component points to the inserted element. Otherwise the first component points to the element that prevents insertion. </p></td>
460 <li class="listitem">
461 <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">></span> <a name="idm45711349168048-bb"></a><span class="identifier">insert</span><span class="special">(</span><span class="identifier">const_reference</span> value<span class="special">)</span><span class="special">;</span></pre>
462 <p>Insertion method</p>
466 <div class="variablelist"><table border="0" class="variablelist compact">
468 <col align="left" valign="top">
473 <td><p><span class="term">Parameters:</span></p></td>
474 <td><div class="variablelist"><table border="0" class="variablelist compact">
476 <col align="left" valign="top">
480 <td><p><span class="term"><code class="computeroutput">value</code></span></p></td>
481 <td><p>An element to be inserted. </p></td>
486 <td><p><span class="term">Returns:</span></p></td>
487 <td><p>A pair of values. If second is true, the insertion succeeded and the first component points to the inserted element. Otherwise the first component points to the element that prevents insertion. </p></td>
492 <li class="listitem">
493 <pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> FwdIteratorT<span class="special">></span>
494 <span class="keyword">void</span> <a name="idm45711349164608-bb"></a><span class="identifier">insert</span><span class="special">(</span><span class="identifier">FwdIteratorT</span> begin<span class="special">,</span> <span class="identifier">FwdIteratorT</span> end<span class="special">)</span><span class="special">;</span></pre>
495 <p>Mass insertion method.</p>
498 <div class="variablelist"><table border="0" class="variablelist compact">
500 <col align="left" valign="top">
504 <td><p><span class="term">Parameters:</span></p></td>
505 <td><div class="variablelist"><table border="0" class="variablelist compact">
507 <col align="left" valign="top">
512 <td><p><span class="term"><code class="computeroutput">begin</code></span></p></td>
513 <td><p>A forward iterator that points to the first element to be inserted. </p></td>
516 <td><p><span class="term"><code class="computeroutput">end</code></span></p></td>
517 <td><p>A forward iterator that points to the after-the-last element to be inserted. </p></td>
524 <li class="listitem">
525 <pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> FwdIteratorT<span class="special">,</span> <span class="keyword">typename</span> OutputIteratorT<span class="special">></span>
526 <span class="keyword">void</span> <a name="idm45711349159888-bb"></a><span class="identifier">insert</span><span class="special">(</span><span class="identifier">FwdIteratorT</span> begin<span class="special">,</span> <span class="identifier">FwdIteratorT</span> end<span class="special">,</span> <span class="identifier">OutputIteratorT</span> out<span class="special">)</span><span class="special">;</span></pre>
527 <p>Mass insertion method with ability to acquire iterators to the inserted elements.</p>
530 <div class="variablelist"><table border="0" class="variablelist compact">
532 <col align="left" valign="top">
536 <td><p><span class="term">Parameters:</span></p></td>
537 <td><div class="variablelist"><table border="0" class="variablelist compact">
539 <col align="left" valign="top">
544 <td><p><span class="term"><code class="computeroutput">begin</code></span></p></td>
545 <td><p>A forward iterator that points to the first element to be inserted. </p></td>
548 <td><p><span class="term"><code class="computeroutput">end</code></span></p></td>
549 <td><p>A forward iterator that points to the after-the-last element to be inserted. </p></td>
552 <td><p><span class="term"><code class="computeroutput">out</code></span></p></td>
553 <td><p>An output iterator that receives results of insertion of the elements </p></td>
560 <li class="listitem">
561 <pre class="literallayout"><span class="identifier">size_type</span> <a name="idm45711349153392-bb"></a><span class="identifier">erase</span><span class="special">(</span><span class="identifier">key_type</span> key<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
562 <p>The method erases all attributes with the specified name</p>
567 <div class="variablelist"><table border="0" class="variablelist compact">
569 <col align="left" valign="top">
574 <td><p><span class="term">Parameters:</span></p></td>
575 <td><div class="variablelist"><table border="0" class="variablelist compact">
577 <col align="left" valign="top">
581 <td><p><span class="term"><code class="computeroutput">key</code></span></p></td>
582 <td><p>Attribute name. </p></td>
587 <td><p><span class="term">Postconditions:</span></p></td>
588 <td><p>All iterators to the erased elements become invalid. </p></td>
591 <td><p><span class="term">Returns:</span></p></td>
592 <td><p>Tne number of erased elements </p></td>
597 <li class="listitem">
598 <pre class="literallayout"><span class="keyword">void</span> <a name="idm45711349149216-bb"></a><span class="identifier">erase</span><span class="special">(</span><span class="identifier">iterator</span> it<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
599 <p>The method erases the specified attribute</p>
604 <div class="variablelist"><table border="0" class="variablelist compact">
606 <col align="left" valign="top">
611 <td><p><span class="term">Parameters:</span></p></td>
612 <td><div class="variablelist"><table border="0" class="variablelist compact">
614 <col align="left" valign="top">
618 <td><p><span class="term"><code class="computeroutput">it</code></span></p></td>
619 <td><p>A valid iterator to the element to be erased. </p></td>
624 <td><p><span class="term">Postconditions:</span></p></td>
625 <td><p>All iterators to the erased element become invalid. </p></td>
628 <td><p><span class="term">Returns:</span></p></td>
629 <td><p>Tne number of erased elements </p></td>
634 <li class="listitem">
635 <pre class="literallayout"><span class="keyword">void</span> <a name="idm45711349145024-bb"></a><span class="identifier">erase</span><span class="special">(</span><span class="identifier">iterator</span> begin<span class="special">,</span> <span class="identifier">iterator</span> end<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
636 <p>The method erases all attributes within the specified range</p>
641 <div class="variablelist"><table border="0" class="variablelist compact">
643 <col align="left" valign="top">
648 <td><p><span class="term">Parameters:</span></p></td>
649 <td><div class="variablelist"><table border="0" class="variablelist compact">
651 <col align="left" valign="top">
656 <td><p><span class="term"><code class="computeroutput">begin</code></span></p></td>
657 <td><p>An iterator that points to the first element to be erased. </p></td>
660 <td><p><span class="term"><code class="computeroutput">end</code></span></p></td>
661 <td><p>An iterator that points to the after-the-last element to be erased. </p></td>
667 <td><p><span class="term">Requires:</span></p></td>
668 <td><p><span class="emphasis"><em>end</em></span> is reachable from <span class="emphasis"><em>begin</em></span> with a finite number of increments. </p></td>
671 <td><p><span class="term">Postconditions:</span></p></td>
672 <td><p>All iterators to the erased elements become invalid. </p></td>
677 <li class="listitem">
678 <pre class="literallayout"><span class="keyword">void</span> <a name="idm45711349138912-bb"></a><span class="identifier">clear</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
679 <p>The method removes all elements from the container</p>
682 <div class="variablelist"><table border="0" class="variablelist compact">
684 <col align="left" valign="top">
688 <td><p><span class="term">Postconditions:</span></p></td>
689 <td><p><code class="computeroutput">empty() == true</code> </p></td>
697 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
698 <td align="left"></td>
699 <td align="right"><div class="copyright-footer">Copyright © 2007-2016 Andrey Semashev<p>
700 Distributed under the Boost Software License, Version 1.0. (See accompanying
701 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>).
706 <div class="spirit-nav">
707 <a accesskey="p" href="operator_idm45711349235344.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../attributes.html#header.boost.log.attributes.attribute_set_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="swap_idm45711349124800.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>