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 class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Chapter��6.�� 19 Db_multimap </th> 20 </tr> 21 <tr> 22 <td width="20%" align="left"><a accesskey="p" href="stldb_mapoperator_ueq.html">Prev</a>��</td> 23 <th width="60%" align="center">��</th> 24 <td width="20%" align="right">��<a accesskey="n" href="stldb_multimaperase.html">Next</a></td> 25 </tr> 26 </table> 27 <hr /> 28 </div> 29 <div class="chapter" lang="en" xml:lang="en"> 30 <div class="titlepage"> 31 <div> 32 <div> 33 <h2 class="title"><a id="db_multimap"></a>Chapter��6.�� 34 Db_multimap </h2> 35 </div> 36 </div> 37 </div> 38 <p>This class is the combination of std::multimap and hash_multimap. </p> 39 <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> 40 <h4><a id="id1552769"></a> 41See Also 42</h4> 43 <p> </p> 44 <p><a class="link" href="db_container.html" title="Chapter��3.�� Db_container">db_container</a> 45 <a class="link" href="db_map.html" title="Chapter��5.�� Db_map">db_map</a> 46 </p> 47 <div class="sect2" lang="en" xml:lang="en"> 48 <div class="titlepage"> 49 <div> 50 <div> 51 <h3 class="title"><a id="id1553278"></a> 52Class Template Parameters</h3> 53 </div> 54 </div> 55 </div> 56 <div class="sect3" lang="en" xml:lang="en"> 57 <div class="titlepage"> 58 <div> 59 <div> 60 <h4 class="title"><a id="id1553284"></a> 61kdt</h4> 62 </div> 63 </div> 64 </div> 65 <p>The key data type. </p> 66 </div> 67 <div class="sect3" lang="en" xml:lang="en"> 68 <div class="titlepage"> 69 <div> 70 <div> 71 <h4 class="title"><a id="id1553525"></a> 72ddt</h4> 73 </div> 74 </div> 75 </div> 76 <p>The data data type. <a class="link" href="db_multimap.html" title="Chapter��6.�� Db_multimap">db_multimap</a> 77 stores key/data pairs. </p> 78 </div> 79 <div class="sect3" lang="en" xml:lang="en"> 80 <div class="titlepage"> 81 <div> 82 <div> 83 <h4 class="title"><a id="id1553598"></a> 84value_type_sub</h4> 85 </div> 86 </div> 87 </div> 88 <p>Do not specify anything if ddt type is a class/struct type; Otherwise, specify ElementHolder<ddt> to it. </p> 89 </div> 90 <div class="sect3" lang="en" xml:lang="en"> 91 <div class="titlepage"> 92 <div> 93 <div> 94 <h4 class="title"><a id="id1553382"></a> 95iterator_t</h4> 96 </div> 97 </div> 98 </div> 99 <p>Never specify anything to this type parameter. It is only used internally. </p> 100 </div> 101 </div> 102 <h4><a id="id1553385"></a> Public Members </h4> 103 <div class="informaltable"> 104 <table border="1" width="80%"> 105 <colgroup> 106 <col /> 107 <col /> 108 </colgroup> 109 <thead> 110 <tr> 111 <th>Member</th> 112 <th>Description</th> 113 </tr> 114 </thead> 115 <tbody> 116 <tr> 117 <td> 118<a class="xref" href="db_multimap.html#stldb_multimapinsert" title="insert"> 119insert 120</a> 121</td> 122 <td> 123 <p>Range insertion. </p> </td> 124 </tr> 125 <tr> 126 <td> 127<a class="xref" href="stldb_multimaperase.html" title="erase"> 128erase 129</a> 130</td> 131 <td> 132 <p>Erase elements by key. </p> </td> 133 </tr> 134 <tr> 135 <td> 136<a class="xref" href="stldb_multimapequal_range.html" title="equal_range"> 137equal_range 138</a> 139</td> 140 <td> 141 <p>Find the range within which all keys equal to specified key x. </p> </td> 142 </tr> 143 <tr> 144 <td> 145<a class="xref" href="stldb_multimapequal_range_N.html" title="equal_range_N"> 146equal_range_N 147</a> 148</td> 149 <td> 150 <p>Find equal range and number of key/data pairs in the range. </p> </td> 151 </tr> 152 <tr> 153 <td> 154<a class="xref" href="stldb_multimapcount.html" title="count"> 155count 156</a> 157</td> 158 <td> 159 <p>Count the number of key/data pairs having specified key x. </p> </td> 160 </tr> 161 <tr> 162 <td> 163<a class="xref" href="stldb_multimapupper_bound.html" title="upper_bound"> 164upper_bound 165</a> 166</td> 167 <td> 168 <p>Find the least key greater than x. </p> </td> 169 </tr> 170 <tr> 171 <td> 172<a class="xref" href="stldb_multimapdb_multimap.html" title="db_multimap"> 173db_multimap 174</a> 175</td> 176 <td> 177 <p>Constructor. </p> </td> 178 </tr> 179 <tr> 180 <td> 181<a class="xref" href="stldb_multimapdstr_db_multimap.html" title="~db_multimap"> 182~db_multimap 183</a> 184</td> 185 <td> 186 </td> 187 </tr> 188 <tr> 189 <td> 190<a class="xref" href="stldb_multimapoperator_assign.html" title="operator="> 191operator= 192</a> 193</td> 194 <td> 195 <p>Container content assignment operator. </p> </td> 196 </tr> 197 <tr> 198 <td> 199<a class="xref" href="stldb_multimapswap.html" title="swap"> 200swap 201</a> 202</td> 203 <td> 204 <p>Swap content with another multimap container. </p> </td> 205 </tr> 206 <tr> 207 <td> 208<a class="xref" href="stldb_multimapoperator_eq.html" title="operator=="> 209operator== 210</a> 211</td> 212 <td> 213 <p>Returns whether the two containers have identical content. </p> </td> 214 </tr> 215 <tr> 216 <td> 217<a class="xref" href="stldb_multimapoperator_ueq.html" title="operator!="> 218operator!= 219</a> 220</td> 221 <td> 222 <p>Container unequality comparison operator. </p> </td> 223 </tr> 224 </tbody> 225 </table> 226 </div> 227 <h4><a id="id1553698"></a> 228Group</h4> 229 <p> 230<a class="xref" href="dbstl_containers.html" title="Chapter��2.�� Dbstl Container Classes"> 231 Dbstl Container Classes </a> 232</p> 233 <p> 234</p> 235 <div class="sect1" lang="en" xml:lang="en"> 236 <div class="titlepage"> 237 <div> 238 <div> 239 <h2 class="title" style="clear: both"><a id="stldb_multimapinsert"></a> 240insert 241</h2> 242 </div> 243 </div> 244 </div> 245 <div class="sect2" lang="en" xml:lang="en"> 246 <div class="titlepage"> 247 <div> 248 <div> 249 <h3 class="title"><a id="func_details"></a> 250Function Details</h3> 251 </div> 252 </div> 253 </div> 254 <pre class="programlisting"> 255void��insert(InputIterator��first, 256��������InputIterator��last) 257 </pre> 258 <div class="sect3" lang="en" xml:lang="en"> 259 <div class="titlepage"></div> 260 <p>Range insertion. </p> 261 <p>Insert a range [first, last) of key/data pairs into this container. </p> 262 </div> 263 <div class="sect3" lang="en" xml:lang="en"> 264 <div class="titlepage"> 265 <div> 266 <div> 267 <h4 class="title"><a id="id1553466"></a> 268Parameters</h4> 269 </div> 270 </div> 271 </div> 272 <div class="sect4" lang="en" xml:lang="en"> 273 <div class="titlepage"> 274 <div> 275 <div> 276 <h5 class="title"><a id="id1553758"></a> 277 last </h5> 278 </div> 279 </div> 280 </div> 281 <p>The open boundary of the range. </p> 282 </div> 283 <div class="sect4" lang="en" xml:lang="en"> 284 <div class="titlepage"> 285 <div> 286 <div> 287 <h5 class="title"><a id="id1553828"></a> 288 first </h5> 289 </div> 290 </div> 291 </div> 292 <p>The closed boundary of the range. </p> 293 </div> 294 </div> 295 <pre class="programlisting"> 296void��insert(const_iterator��&first, 297��������const_iterator��&last) 298 </pre> 299 <div class="sect3" lang="en" xml:lang="en"> 300 <div class="titlepage"></div> 301 <p>Range insertion. </p> 302 <p>Insert a range [first, last) of key/data pairs into this container. </p> 303 </div> 304 <div class="sect3" lang="en" xml:lang="en"> 305 <div class="titlepage"> 306 <div> 307 <div> 308 <h4 class="title"><a id="id1553784"></a> 309Parameters</h4> 310 </div> 311 </div> 312 </div> 313 <div class="sect4" lang="en" xml:lang="en"> 314 <div class="titlepage"> 315 <div> 316 <div> 317 <h5 class="title"><a id="id1553825"></a> 318 last </h5> 319 </div> 320 </div> 321 </div> 322 <p>The open boundary of the range. </p> 323 </div> 324 <div class="sect4" lang="en" xml:lang="en"> 325 <div class="titlepage"> 326 <div> 327 <div> 328 <h5 class="title"><a id="id1553637"></a> 329 first </h5> 330 </div> 331 </div> 332 </div> 333 <p>The closed boundary of the range. </p> 334 </div> 335 </div> 336 <pre class="programlisting"> 337iterator��insert(const��value_type��&x) 338 </pre> 339 <div class="sect3" lang="en" xml:lang="en"> 340 <div class="titlepage"></div> 341 <p>Insert a single key/data pair if the key is not in the container. </p> 342 <p></p> 343 </div> 344 <div class="sect3" lang="en" xml:lang="en"> 345 <div class="titlepage"> 346 <div> 347 <div> 348 <h4 class="title"><a id="id1553392"></a> 349Parameters</h4> 350 </div> 351 </div> 352 </div> 353 <div class="sect4" lang="en" xml:lang="en"> 354 <div class="titlepage"> 355 <div> 356 <div> 357 <h5 class="title"><a id="id1553229"></a> 358 x </h5> 359 </div> 360 </div> 361 </div> 362 <p>The key/data pair to insert. </p> 363 </div> 364 </div> 365 <div class="sect3" lang="en" xml:lang="en"> 366 <div class="titlepage"> 367 <div> 368 <div> 369 <h4 class="title"><a id="id1553583"></a> 370Return Value</h4> 371 </div> 372 </div> 373 </div> 374 <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> 375 </div> 376 </div> 377 <div class="sect2" lang="en" xml:lang="en"> 378 <div class="titlepage"> 379 <div> 380 <div> 381 <h3 class="title"><a id="id1553230"></a> 382Group: Insert Functions</h3> 383 </div> 384 </div> 385 </div> 386 <div class="simplesect" lang="en" xml:lang="en"> 387 <div class="titlepage"></div> 388 <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> 389 </div> 390 <p> 391</p> 392 </div> 393 <div class="sect2" lang="en" xml:lang="en"> 394 <div class="titlepage"> 395 <div> 396 <div> 397 <h3 class="title"><a id="id1553819"></a> 398Class</h3> 399 </div> 400 </div> 401 </div> 402 <p> 403 <a class="link" href="db_multimap.html" title="Chapter��6.�� Db_multimap"> 404 db_multimap</a> 405 </p> 406 </div> 407 </div> 408 </div> 409 <div class="navfooter"> 410 <hr /> 411 <table width="100%" summary="Navigation footer"> 412 <tr> 413 <td width="40%" align="left"><a accesskey="p" href="stldb_mapoperator_ueq.html">Prev</a>��</td> 414 <td width="20%" align="center">��</td> 415 <td width="40%" align="right">��<a accesskey="n" href="stldb_multimaperase.html">Next</a></td> 416 </tr> 417 <tr> 418 <td width="40%" align="left" valign="top"> 419operator!= 420��</td> 421 <td width="20%" align="center"> 422 <a accesskey="h" href="index.html">Home</a> 423 </td> 424 <td width="40%" align="right" valign="top">�� 425erase 426</td> 427 </tr> 428 </table> 429 </div> 430 </body> 431</html> 432