| 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"> |
|---|
| 4 | <!-- Copyright Aleksey Gurtovoy 2006. Distributed under the Boost --> |
|---|
| 5 | <!-- Software License, Version 1.0. (See accompanying --> |
|---|
| 6 | <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> |
|---|
| 7 | <head> |
|---|
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|---|
| 9 | <meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" /> |
|---|
| 10 | <title>The MPL Reference Manual: set</title> |
|---|
| 11 | <link rel="stylesheet" href="../style.css" type="text/css" /> |
|---|
| 12 | </head> |
|---|
| 13 | <body class="docframe refmanual"> |
|---|
| 14 | <table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./deque.html" class="navigation-link">Prev</a> <a href="./map.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./deque.html" class="navigation-link">Back</a> <a href="./map.html" class="navigation-link">Along</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./classes.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td> |
|---|
| 15 | <td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./sequences.html" class="navigation-link">Sequences</a> / <a href="./classes.html" class="navigation-link">Classes</a> / <a href="./set.html" class="navigation-link">set</a></td> |
|---|
| 16 | </tr></table><div class="header-separator"></div> |
|---|
| 17 | <div class="section" id="set"> |
|---|
| 18 | <h1><a class="toc-backref" href="./classes.html#id338" name="set">set</a></h1> |
|---|
| 19 | <div class="section" id="set-description"> |
|---|
| 20 | <h3><a class="subsection-title" href="#description" name="description">Description</a></h3> |
|---|
| 21 | <p><tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt> is a <a class="reference" href="./variadic-sequence.html">variadic</a>, <a class="reference" href="./associative-sequence.html">associative</a>, <a class="reference" href="./extensible-associative.html">extensible</a> sequence of types that |
|---|
| 22 | supports constant-time insertion and removal of elements, and testing for membership. |
|---|
| 23 | A <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt> may contain at most one element for each key.</p> |
|---|
| 24 | </div> |
|---|
| 25 | <div class="section" id="set-header"> |
|---|
| 26 | <h3><a class="subsection-title" href="#header" name="header">Header</a></h3> |
|---|
| 27 | <table border="1" class="table"> |
|---|
| 28 | <colgroup> |
|---|
| 29 | <col width="26%" /> |
|---|
| 30 | <col width="74%" /> |
|---|
| 31 | </colgroup> |
|---|
| 32 | <thead valign="bottom"> |
|---|
| 33 | <tr><th>Sequence form</th> |
|---|
| 34 | <th>Header</th> |
|---|
| 35 | </tr> |
|---|
| 36 | </thead> |
|---|
| 37 | <tbody valign="top"> |
|---|
| 38 | <tr><td>Variadic</td> |
|---|
| 39 | <td><tt class="literal"><span class="pre">#include <<a href="../../../../boost/mpl/set.hpp" class="header">boost/mpl/set.hpp</a>></span></tt></td> |
|---|
| 40 | </tr> |
|---|
| 41 | <tr><td>Numbered</td> |
|---|
| 42 | <td><tt class="literal"><span class="pre">#include <boost/mpl/set/set</span></tt><em>n</em><tt class="literal"><span class="pre">.hpp></span></tt></td> |
|---|
| 43 | </tr> |
|---|
| 44 | </tbody> |
|---|
| 45 | </table> |
|---|
| 46 | </div> |
|---|
| 47 | <div class="section" id="set-model-of"> |
|---|
| 48 | <h3><a class="subsection-title" href="#model-of" name="model-of">Model of</a></h3> |
|---|
| 49 | <ul class="simple"> |
|---|
| 50 | <li><a class="reference" href="./variadic-sequence.html">Variadic Sequence</a></li> |
|---|
| 51 | <li><a class="reference" href="./associative-sequence.html">Associative Sequence</a></li> |
|---|
| 52 | <li><a class="reference" href="./extensible-associative.html">Extensible Associative Sequence</a></li> |
|---|
| 53 | </ul> |
|---|
| 54 | </div> |
|---|
| 55 | <div class="section" id="set-expression-semantics"> |
|---|
| 56 | <h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3> |
|---|
| 57 | <p>In the following table, <tt class="literal"><span class="pre">s</span></tt> is an instance of <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt>, <tt class="literal"><span class="pre">pos</span></tt> is an iterator into <tt class="literal"><span class="pre">s</span></tt>, |
|---|
| 58 | and <tt class="literal"><span class="pre">x</span></tt>, <tt class="literal"><span class="pre">k</span></tt>, and <em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub> are arbitrary types.</p> |
|---|
| 59 | <table border="1" class="table"> |
|---|
| 60 | <colgroup> |
|---|
| 61 | <col width="40%" /> |
|---|
| 62 | <col width="60%" /> |
|---|
| 63 | </colgroup> |
|---|
| 64 | <thead valign="bottom"> |
|---|
| 65 | <tr><th>Expression</th> |
|---|
| 66 | <th>Semantics</th> |
|---|
| 67 | </tr> |
|---|
| 68 | </thead> |
|---|
| 69 | <tbody valign="top"> |
|---|
| 70 | <tr><td><pre class="first last literal-block"> |
|---|
| 71 | <a href="./set.html" class="identifier">set</a><<em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>> |
|---|
| 72 | <a href="./set.html" class="identifier">set</a><em>n</em><<em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>> |
|---|
| 73 | </pre> |
|---|
| 74 | </td> |
|---|
| 75 | <td><tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt> of elements <em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>; see |
|---|
| 76 | <a class="reference" href="./variadic-sequence.html">Variadic Sequence</a>.</td> |
|---|
| 77 | </tr> |
|---|
| 78 | <tr><td><pre class="first last literal-block"> |
|---|
| 79 | <a href="./set.html" class="identifier">set</a><<em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>>::type |
|---|
| 80 | <a href="./set.html" class="identifier">set</a><em>n</em><<em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>>::type |
|---|
| 81 | </pre> |
|---|
| 82 | </td> |
|---|
| 83 | <td>Identical to <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt><em>n</em><tt class="literal"><span class="pre"><</span></tt><em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub><tt class="literal"><span class="pre">></span></tt>; |
|---|
| 84 | see <a class="reference" href="./variadic-sequence.html">Variadic Sequence</a>.</td> |
|---|
| 85 | </tr> |
|---|
| 86 | <tr><td><tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a><s>::type</span></tt></td> |
|---|
| 87 | <td>An iterator pointing to the beginning of <tt class="literal"><span class="pre">s</span></tt>; |
|---|
| 88 | see <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 89 | </tr> |
|---|
| 90 | <tr><td><tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a><s>::type</span></tt></td> |
|---|
| 91 | <td>An iterator pointing to the end of <tt class="literal"><span class="pre">s</span></tt>; |
|---|
| 92 | see <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 93 | </tr> |
|---|
| 94 | <tr><td><tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a><s>::type</span></tt></td> |
|---|
| 95 | <td>The size of <tt class="literal"><span class="pre">s</span></tt>; see <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 96 | </tr> |
|---|
| 97 | <tr><td><tt class="literal"><span class="pre"><a href="./empty.html" class="identifier">empty</a><s>::type</span></tt></td> |
|---|
| 98 | <td>A boolean <a class="reference" href="./integral-constant.html">Integral Constant</a> <tt class="literal"><span class="pre">c</span></tt> such that |
|---|
| 99 | <tt class="literal"><span class="pre">c::value</span> <span class="pre">==</span> <span class="pre">true</span></tt> if and only if <tt class="literal"><span class="pre">s</span></tt> is empty; see |
|---|
| 100 | <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 101 | </tr> |
|---|
| 102 | <tr><td><tt class="literal"><span class="pre"><a href="./front.html" class="identifier">front</a><s>::type</span></tt></td> |
|---|
| 103 | <td>The first element in <tt class="literal"><span class="pre">s</span></tt>; see |
|---|
| 104 | <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 105 | </tr> |
|---|
| 106 | <tr><td><tt class="literal"><span class="pre"><a href="./has-key.html" class="identifier">has_key</a><s,k>::type</span></tt></td> |
|---|
| 107 | <td>A boolean <a class="reference" href="./integral-constant.html">Integral Constant</a> <tt class="literal"><span class="pre">c</span></tt> such that |
|---|
| 108 | <tt class="literal"><span class="pre">c::value</span> <span class="pre">==</span> <span class="pre">true</span></tt> if and only if there is one or more elements |
|---|
| 109 | with the key <tt class="literal"><span class="pre">k</span></tt> in <tt class="literal"><span class="pre">s</span></tt>; see <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 110 | </tr> |
|---|
| 111 | <tr><td><tt class="literal"><span class="pre"><a href="./count.html" class="identifier">count</a><s,k>::type</span></tt></td> |
|---|
| 112 | <td>The number of elements with the key <tt class="literal"><span class="pre">k</span></tt> in <tt class="literal"><span class="pre">s</span></tt>; |
|---|
| 113 | see <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 114 | </tr> |
|---|
| 115 | <tr><td><tt class="literal"><span class="pre"><a href="./order.html" class="identifier">order</a><s,k>::type</span></tt></td> |
|---|
| 116 | <td>A unique unsigned <a class="reference" href="./integral-constant.html">Integral Constant</a> associated with |
|---|
| 117 | the key <tt class="literal"><span class="pre">k</span></tt> in <tt class="literal"><span class="pre">s</span></tt>; see <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 118 | </tr> |
|---|
| 119 | <tr><td><pre class="first last literal-block"> |
|---|
| 120 | <a href="./at.html" class="identifier">at</a><s,k>::type |
|---|
| 121 | <a href="./at.html" class="identifier">at</a><s,k,def>::type |
|---|
| 122 | </pre> |
|---|
| 123 | </td> |
|---|
| 124 | <td>The element associated with the key <tt class="literal"><span class="pre">k</span></tt> in |
|---|
| 125 | <tt class="literal"><span class="pre">s</span></tt>; see <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 126 | </tr> |
|---|
| 127 | <tr><td><tt class="literal"><span class="pre"><a href="./key-type.html" class="identifier">key_type</a><s,x>::type</span></tt></td> |
|---|
| 128 | <td>Identical to <tt class="literal"><span class="pre">x</span></tt>; see <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 129 | </tr> |
|---|
| 130 | <tr><td><tt class="literal"><span class="pre"><a href="./value-type.html" class="identifier">value_type</a><s,x>::type</span></tt></td> |
|---|
| 131 | <td>Identical to <tt class="literal"><span class="pre">x</span></tt>; see <a class="reference" href="./associative-sequence.html">Associative Sequence</a>.</td> |
|---|
| 132 | </tr> |
|---|
| 133 | <tr><td><tt class="literal"><span class="pre"><a href="./insert.html" class="identifier">insert</a><s,x>::type</span></tt></td> |
|---|
| 134 | <td><p class="first">A new <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt> equivalent to <tt class="literal"><span class="pre">s</span></tt> except that</p> |
|---|
| 135 | <pre class="literal-block"> |
|---|
| 136 | <a href="./at.html" class="identifier">at</a>< t, <a href="./key-type.html" class="identifier">key_type</a><s,x>::type >::type |
|---|
| 137 | </pre> |
|---|
| 138 | <p class="last">is identical to <tt class="literal"><span class="pre"><a href="./value-type.html" class="identifier">value_type</a><s,x>::type</span></tt>.</p> |
|---|
| 139 | </td> |
|---|
| 140 | </tr> |
|---|
| 141 | <tr><td><tt class="literal"><span class="pre"><a href="./insert.html" class="identifier">insert</a><s,pos,x>::type</span></tt></td> |
|---|
| 142 | <td>Equivalent to <tt class="literal"><span class="pre"><a href="./insert.html" class="identifier">insert</a><s,x>::type</span></tt>; <tt class="literal"><span class="pre">pos</span></tt> is ignored.</td> |
|---|
| 143 | </tr> |
|---|
| 144 | <tr><td><tt class="literal"><span class="pre"><a href="./erase-key.html" class="identifier">erase_key</a><s,k>::type</span></tt></td> |
|---|
| 145 | <td>A new <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt> equivalent to <tt class="literal"><span class="pre">s</span></tt> except that |
|---|
| 146 | <tt class="literal"><span class="pre"><a href="./has-key.html" class="identifier">has_key</a><t,</span> <span class="pre">k>::value</span> <span class="pre">==</span> <span class="pre">false</span></tt>.</td> |
|---|
| 147 | </tr> |
|---|
| 148 | <tr><td><tt class="literal"><span class="pre"><a href="./erase.html" class="identifier">erase</a><s,pos>::type</span></tt></td> |
|---|
| 149 | <td>Equivalent to <tt class="literal"><span class="pre"><a href="./erase.html" class="identifier">erase</a><s,</span> <span class="pre"><a href="./deref.html" class="identifier">deref</a><pos>::type</span> <span class="pre">>::type</span></tt>.</td> |
|---|
| 150 | </tr> |
|---|
| 151 | <tr><td><tt class="literal"><span class="pre"><a href="./clear.html" class="identifier">clear</a><s>::type</span></tt></td> |
|---|
| 152 | <td>An empty <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt>; see <a class="refentry reference" href="./clear.html"><tt class="refentry literal"><span class="pre">clear</span></tt></a>.</td> |
|---|
| 153 | </tr> |
|---|
| 154 | </tbody> |
|---|
| 155 | </table> |
|---|
| 156 | </div> |
|---|
| 157 | <div class="section" id="set-example"> |
|---|
| 158 | <h3><a class="subsection-title" href="#example" name="example">Example</a></h3> |
|---|
| 159 | <pre class="literal-block"> |
|---|
| 160 | typedef <a href="./set.html" class="identifier">set</a>< int,long,double,<a href="./int.html" class="identifier">int_</a><5> > s; |
|---|
| 161 | |
|---|
| 162 | <a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( <a href="./size.html" class="identifier">size</a><s>::value, ==, 4 ); |
|---|
| 163 | <a href="./assert-not.html" class="identifier">BOOST_MPL_ASSERT_NOT</a>(( <a href="./empty.html" class="identifier">empty</a><s> )); |
|---|
| 164 | |
|---|
| 165 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< <a href="./at.html" class="identifier">at</a><s,int>::type, int > )); |
|---|
| 166 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< <a href="./at.html" class="identifier">at</a><s,long>::type, long > )); |
|---|
| 167 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< <a href="./at.html" class="identifier">at</a><s,<a href="./int.html" class="identifier">int_</a><5> >::type, <a href="./int.html" class="identifier">int_</a><5> > )); |
|---|
| 168 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< <a href="./at.html" class="identifier">at</a><s,char>::type, <a href="./void.html" class="identifier">void_</a> > )); |
|---|
| 169 | </pre> |
|---|
| 170 | </div> |
|---|
| 171 | <div class="section" id="set-see-also"> |
|---|
| 172 | <h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3> |
|---|
| 173 | <p><a class="reference" href="./sequences.html">Sequences</a>, <a class="reference" href="./variadic-sequence.html">Variadic Sequence</a>, <a class="reference" href="./associative-sequence.html">Associative Sequence</a>, <a class="reference" href="./extensible-associative.html">Extensible Associative Sequence</a>, <a class="refentry reference" href="./set-c.html"><tt class="refentry literal"><span class="pre">set_c</span></tt></a>, <a class="refentry reference" href="./map.html"><tt class="refentry literal"><span class="pre">map</span></tt></a>, <a class="refentry reference" href="./vector.html"><tt class="refentry literal"><span class="pre">vector</span></tt></a></p> |
|---|
| 174 | <!-- modtime: November 15, 2004 01:17:24 +0000 --> |
|---|
| 175 | <!-- Sequences/Classes//map |50 --> |
|---|
| 176 | </div> |
|---|
| 177 | </div> |
|---|
| 178 | |
|---|
| 179 | <div class="footer-separator"></div> |
|---|
| 180 | <table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./deque.html" class="navigation-link">Prev</a> <a href="./map.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./deque.html" class="navigation-link">Back</a> <a href="./map.html" class="navigation-link">Along</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./classes.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td> |
|---|
| 181 | </tr></table></body> |
|---|
| 182 | </html> |
|---|