| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 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"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>Chapter 6. Db_multimap</title> |
| 7 | <link rel="stylesheet" href="apiReference.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB C++ Standard Template Library API Reference" /> |
| 10 | <link rel="up" href="index.html" title="Berkeley DB C++ Standard Template Library API Reference" /> |
| 11 | <link rel="prev" href="stldb_mapoperator_ueq.html" title="operator!=" /> |
| 12 | <link rel="next" href="stldb_multimaperase.html" title="erase" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Chapter 6. |
| 22 | Db_multimap </th> |
| 23 | </tr> |
| 24 | <tr> |
| 25 | <td width="20%" align="left"><a accesskey="p" href="stldb_mapoperator_ueq.html">Prev</a> </td> |
| 26 | <th width="60%" align="center"> </th> |
| 27 | <td width="20%" align="right"> <a accesskey="n" href="stldb_multimaperase.html">Next</a></td> |
| 28 | </tr> |
| 29 | </table> |
| 30 | <hr /> |
| 31 | </div> |
| 32 | <div class="chapter" lang="en" xml:lang="en"> |
| 33 | <div class="titlepage"> |
| 34 | <div> |
| 35 | <div> |
| 36 | <h2 class="title"><a id="db_multimap"></a>Chapter 6. |
| 37 | Db_multimap </h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <p>This class is the combination of std::multimap and hash_multimap. </p> |
| 42 | <p>By setting database handles as DB_BTREE or DB_HASH type respectively, you will be using an equivalent of std::multimap or hash_multimap respectively. Database(dbp) and environment(penv) handle requirement: The dbp handle must meet the following requirement: 1. Database type should be DB_BTREE or DB_HASH. 2. Either DB_DUP or DB_DUPSORT flag must be set. Note that so far Berkeley DB does not allow DB_DUPSORT be set and the database is storing identical key/data pairs, i.e. we can't store two (1, 2), (1, 2) pairs into a database D with DB_DUPSORT flag set, but only can do so with DB_DUP flag set; But we can store a (1, 2) pair and a (1, 3) pair into D with DB_DUPSORT flag set. So if your data set allows DB_DUPSORT flag, you should set it to gain a lot of performance promotion. 3. No DB_RECNUM flag set. 4. No DB_TRUNCATE specified in database open flags. 5. DB_THREAD must be set if you are sharing the database handle across multiple threads directly, or indirectly by sharing the container object across multiple threads. </p> |
| 43 | <h4><a id="idp50524248"></a> |
| 44 | See Also |
| 45 | </h4> |
| 46 | <p> </p> |
| 47 | <p><a class="link" href="db_container.html" title="Chapter 3. Db_container">db_container</a> |
| 48 | <a class="link" href="db_map.html" title="Chapter 5. Db_map">db_map</a> |
| 49 | </p> |
| 50 | <div class="sect2" lang="en" xml:lang="en"> |
| 51 | <div class="titlepage"> |
| 52 | <div> |
| 53 | <div> |
| 54 | <h3 class="title"><a id="idp50483208"></a> |
| 55 | Class Template Parameters</h3> |
| 56 | </div> |
| 57 | </div> |
| 58 | </div> |
| 59 | <div class="sect3" lang="en" xml:lang="en"> |
| 60 | <div class="titlepage"> |
| 61 | <div> |
| 62 | <div> |
| 63 | <h4 class="title"><a id="idp49844168"></a> |
| 64 | kdt</h4> |
| 65 | </div> |
| 66 | </div> |
| 67 | </div> |
| 68 | <p>The key data type. </p> |
| 69 | </div> |
| 70 | <div class="sect3" lang="en" xml:lang="en"> |
| 71 | <div class="titlepage"> |
| 72 | <div> |
| 73 | <div> |
| 74 | <h4 class="title"><a id="idp50376072"></a> |
| 75 | ddt</h4> |
| 76 | </div> |
| 77 | </div> |
| 78 | </div> |
| 79 | <p>The data data type. <a class="link" href="db_multimap.html" title="Chapter 6. Db_multimap">db_multimap</a> |
| 80 | stores key/data pairs. </p> |
| 81 | </div> |
| 82 | <div class="sect3" lang="en" xml:lang="en"> |
| 83 | <div class="titlepage"> |
| 84 | <div> |
| 85 | <div> |
| 86 | <h4 class="title"><a id="idp50570784"></a> |
| 87 | value_type_sub</h4> |
| 88 | </div> |
| 89 | </div> |
| 90 | </div> |
| 91 | <p>Do not specify anything if ddt type is a class/struct type; Otherwise, specify ElementHolder<ddt> to it. </p> |
| 92 | </div> |
| 93 | <div class="sect3" lang="en" xml:lang="en"> |
| 94 | <div class="titlepage"> |
| 95 | <div> |
| 96 | <div> |
| 97 | <h4 class="title"><a id="idp50566872"></a> |
| 98 | iterator_t</h4> |
| 99 | </div> |
| 100 | </div> |
| 101 | </div> |
| 102 | <p>Never specify anything to this type parameter. It is only used internally. </p> |
| 103 | </div> |
| 104 | </div> |
| 105 | <h4><a id="idp50573832"></a> Public Members </h4> |
| 106 | <div class="informaltable"> |
| 107 | <table border="1" width="80%"> |
| 108 | <colgroup> |
| 109 | <col /> |
| 110 | <col /> |
| 111 | </colgroup> |
| 112 | <thead> |
| 113 | <tr> |
| 114 | <th>Member</th> |
| 115 | <th>Description</th> |
| 116 | </tr> |
| 117 | </thead> |
| 118 | <tbody> |
| 119 | <tr> |
| 120 | <td> |
| 121 | <a class="xref" href="db_multimap.html#stldb_multimapinsert" title="insert">insert</a> |
| 122 | </td> |
| 123 | <td> |
| 124 | <p>Range insertion. </p> </td> |
| 125 | </tr> |
| 126 | <tr> |
| 127 | <td> |
| 128 | <a class="xref" href="stldb_multimaperase.html" title="erase">erase</a> |
| 129 | </td> |
| 130 | <td> |
| 131 | <p>Erase elements by key. </p> </td> |
| 132 | </tr> |
| 133 | <tr> |
| 134 | <td> |
| 135 | <a class="xref" href="stldb_multimapequal_range.html" title="equal_range">equal_range</a> |
| 136 | </td> |
| 137 | <td> |
| 138 | <p>Find the range within which all keys equal to specified key x. </p> </td> |
| 139 | </tr> |
| 140 | <tr> |
| 141 | <td> |
| 142 | <a class="xref" href="stldb_multimapequal_range_N.html" title="equal_range_N">equal_range_N</a> |
| 143 | </td> |
| 144 | <td> |
| 145 | <p>Find equal range and number of key/data pairs in the range. </p> </td> |
| 146 | </tr> |
| 147 | <tr> |
| 148 | <td> |
| 149 | <a class="xref" href="stldb_multimapcount.html" title="count">count</a> |
| 150 | </td> |
| 151 | <td> |
| 152 | <p>Count the number of key/data pairs having specified key x. </p> </td> |
| 153 | </tr> |
| 154 | <tr> |
| 155 | <td> |
| 156 | <a class="xref" href="stldb_multimapupper_bound.html" title="upper_bound">upper_bound</a> |
| 157 | </td> |
| 158 | <td> |
| 159 | <p>Find the least key greater than x. </p> </td> |
| 160 | </tr> |
| 161 | <tr> |
| 162 | <td> |
| 163 | <a class="xref" href="stldb_multimapdb_multimap.html" title="db_multimap">db_multimap</a> |
| 164 | </td> |
| 165 | <td> |
| 166 | <p>Constructor. </p> </td> |
| 167 | </tr> |
| 168 | <tr> |
| 169 | <td> |
| 170 | <a class="xref" href="stldb_multimapdstr_db_multimap.html" title="~db_multimap">~db_multimap</a> |
| 171 | </td> |
| 172 | <td> |
| 173 | </td> |
| 174 | </tr> |
| 175 | <tr> |
| 176 | <td> |
| 177 | <a class="xref" href="stldb_multimapoperator_assign.html" title="operator=">operator=</a> |
| 178 | </td> |
| 179 | <td> |
| 180 | <p>Container content assignment operator. </p> </td> |
| 181 | </tr> |
| 182 | <tr> |
| 183 | <td> |
| 184 | <a class="xref" href="stldb_multimapswap.html" title="swap">swap</a> |
| 185 | </td> |
| 186 | <td> |
| 187 | <p>Swap content with another multimap container. </p> </td> |
| 188 | </tr> |
| 189 | <tr> |
| 190 | <td> |
| 191 | <a class="xref" href="stldb_multimapoperator_eq.html" title="operator==">operator==</a> |
| 192 | </td> |
| 193 | <td> |
| 194 | <p>Returns whether the two containers have identical content. </p> </td> |
| 195 | </tr> |
| 196 | <tr> |
| 197 | <td> |
| 198 | <a class="xref" href="stldb_multimapoperator_ueq.html" title="operator!=">operator!=</a> |
| 199 | </td> |
| 200 | <td> |
| 201 | <p>Container unequality comparison operator. </p> </td> |
| 202 | </tr> |
| 203 | </tbody> |
| 204 | </table> |
| 205 | </div> |
| 206 | <h4><a id="idp50081160"></a> |
| 207 | Group</h4> |
| 208 | <p> |
| 209 | <a class="xref" href="dbstl_containers.html" title="Chapter 2. Dbstl Container Classes"> |
| 210 | Dbstl Container Classes </a> |
| 211 | </p> |
| 212 | <p> |
| 213 | </p> |
| 214 | <div class="sect1" lang="en" xml:lang="en"> |
| 215 | <div class="titlepage"> |
| 216 | <div> |
| 217 | <div> |
| 218 | <h2 class="title" style="clear: both"><a id="stldb_multimapinsert"></a>insert</h2> |
| 219 | </div> |
| 220 | </div> |
| 221 | </div> |
| 222 | <div class="sect2" lang="en" xml:lang="en"> |
| 223 | <div class="titlepage"> |
| 224 | <div> |
| 225 | <div> |
| 226 | <h3 class="title"><a id="stldb_multimapinsert_details"></a>Function Details</h3> |
| 227 | </div> |
| 228 | </div> |
| 229 | </div> |
| 230 | <pre class="programlisting"> |
| 231 | void insert(InputIterator first, |
| 232 | InputIterator last) |
| 233 | </pre> |
| 234 | <p>Range insertion. </p> |
| 235 | <p>Insert a range [first, last) of key/data pairs into this container. </p> |
| 236 | <div class="sect3" lang="en" xml:lang="en"> |
| 237 | <div class="titlepage"> |
| 238 | <div> |
| 239 | <div> |
| 240 | <h4 class="title"><a id="idp50590840"></a>Parameters</h4> |
| 241 | </div> |
| 242 | </div> |
| 243 | </div> |
| 244 | <div class="sect4" lang="en" xml:lang="en"> |
| 245 | <div class="titlepage"> |
| 246 | <div> |
| 247 | <div> |
| 248 | <h5 class="title"><a id="idp50600672"></a>last</h5> |
| 249 | </div> |
| 250 | </div> |
| 251 | </div> |
| 252 | <p>The open boundary of the range. </p> |
| 253 | </div> |
| 254 | <div class="sect4" lang="en" xml:lang="en"> |
| 255 | <div class="titlepage"> |
| 256 | <div> |
| 257 | <div> |
| 258 | <h5 class="title"><a id="idp50602552"></a>first</h5> |
| 259 | </div> |
| 260 | </div> |
| 261 | </div> |
| 262 | <p>The closed boundary of the range. </p> |
| 263 | </div> |
| 264 | </div> |
| 265 | <pre class="programlisting"> |
| 266 | void insert(const_iterator &first, |
| 267 | const_iterator &last) |
| 268 | </pre> |
| 269 | <p>Range insertion. </p> |
| 270 | <p>Insert a range [first, last) of key/data pairs into this container. </p> |
| 271 | <div class="sect3" lang="en" xml:lang="en"> |
| 272 | <div class="titlepage"> |
| 273 | <div> |
| 274 | <div> |
| 275 | <h4 class="title"><a id="idp50603016"></a>Parameters</h4> |
| 276 | </div> |
| 277 | </div> |
| 278 | </div> |
| 279 | <div class="sect4" lang="en" xml:lang="en"> |
| 280 | <div class="titlepage"> |
| 281 | <div> |
| 282 | <div> |
| 283 | <h5 class="title"><a id="idp50603208"></a>last</h5> |
| 284 | </div> |
| 285 | </div> |
| 286 | </div> |
| 287 | <p>The open boundary of the range. </p> |
| 288 | </div> |
| 289 | <div class="sect4" lang="en" xml:lang="en"> |
| 290 | <div class="titlepage"> |
| 291 | <div> |
| 292 | <div> |
| 293 | <h5 class="title"><a id="idp50604048"></a>first</h5> |
| 294 | </div> |
| 295 | </div> |
| 296 | </div> |
| 297 | <p>The closed boundary of the range. </p> |
| 298 | </div> |
| 299 | </div> |
| 300 | <pre class="programlisting"> |
| 301 | iterator insert(const value_type &x) |
| 302 | </pre> |
| 303 | <p>Insert a single key/data pair if the key is not in the container. </p> |
| 304 | <div class="sect3" lang="en" xml:lang="en"> |
| 305 | <div class="titlepage"> |
| 306 | <div> |
| 307 | <div> |
| 308 | <h4 class="title"><a id="idp50599464"></a>Parameters</h4> |
| 309 | </div> |
| 310 | </div> |
| 311 | </div> |
| 312 | <div class="sect4" lang="en" xml:lang="en"> |
| 313 | <div class="titlepage"> |
| 314 | <div> |
| 315 | <div> |
| 316 | <h5 class="title"><a id="idp50604496"></a>x</h5> |
| 317 | </div> |
| 318 | </div> |
| 319 | </div> |
| 320 | <p>The key/data pair to insert. </p> |
| 321 | </div> |
| 322 | </div> |
| 323 | <div class="sect3" lang="en" xml:lang="en"> |
| 324 | <div class="titlepage"> |
| 325 | <div> |
| 326 | <div> |
| 327 | <h4 class="title"><a id="idp50370072"></a>Return Value</h4> |
| 328 | </div> |
| 329 | </div> |
| 330 | </div> |
| 331 | <p>A pair P, if insert OK, i.e. the inserted key wasn't in the container, P.first will be the iterator sitting on the inserted key/data pair, and P.second is true; otherwise P.first is an invalid iterator and P.second is false. </p> |
| 332 | </div> |
| 333 | </div> |
| 334 | <div class="sect2" lang="en" xml:lang="en"> |
| 335 | <div class="titlepage"> |
| 336 | <div> |
| 337 | <div> |
| 338 | <h3 class="title"><a id="idp50569336"></a>Group: Insert Functions</h3> |
| 339 | </div> |
| 340 | </div> |
| 341 | </div> |
| 342 | <div class="simplesect" lang="en" xml:lang="en"> |
| 343 | <div class="titlepage"></div> |
| 344 | <p><a class="ulink" href="http://www.cplusplus.com/reference/stl/multimap/insert/" target="_top">http://www.cplusplus.com/reference/stl/multimap/insert/</a> </p> |
| 345 | </div> |
| 346 | <p> |
| 347 | </p> |
| 348 | </div> |
| 349 | <div class="sect2" lang="en" xml:lang="en"> |
| 350 | <div class="titlepage"> |
| 351 | <div> |
| 352 | <div> |
| 353 | <h3 class="title"><a id="idp50600336"></a>Class</h3> |
| 354 | </div> |
| 355 | </div> |
| 356 | </div> |
| 357 | <p> |
| 358 | <a class="link" href="db_multimap.html" title="Chapter 6. Db_multimap">db_multimap</a> |
| 359 | </p> |
| 360 | </div> |
| 361 | </div> |
| 362 | </div> |
| 363 | <div class="navfooter"> |
| 364 | <hr /> |
| 365 | <table width="100%" summary="Navigation footer"> |
| 366 | <tr> |
| 367 | <td width="40%" align="left"><a accesskey="p" href="stldb_mapoperator_ueq.html">Prev</a> </td> |
| 368 | <td width="20%" align="center"> </td> |
| 369 | <td width="40%" align="right"> <a accesskey="n" href="stldb_multimaperase.html">Next</a></td> |
| 370 | </tr> |
| 371 | <tr> |
| 372 | <td width="40%" align="left" valign="top">operator!= </td> |
| 373 | <td width="20%" align="center"> |
| 374 | <a accesskey="h" href="index.html">Home</a> |
| 375 | </td> |
| 376 | <td width="40%" align="right" valign="top"> erase</td> |
| 377 | </tr> |
| 378 | </table> |
| 379 | </div> |
| 380 | </body> |
| 381 | </html> |