⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hash_map.html

📁 Standard Template Library (SOURCE + COMPLETE html man document)
💻 HTML
📖 第 1 页 / 共 2 页
字号:
</TD><TD VAlign=top>Returns the <tt>hasher</tt> object used by the <tt>hash_map</tt>.</TD></TR><TR><TD VAlign=top><tt>key_equal key_eq() const</tt></TD><TD VAlign=top> <A href="HashedAssociativeContainer.html">Hashed Associative Container</A></TD><TD VAlign=top>Returns the <tt>key_equal</tt> object used by the <tt>hash_map</tt>.</TD></TR><TR><TD VAlign=top><tt>hash_map()</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Creates an empty <tt>hash_map</tt>.</TD></TR><TR><TD VAlign=top><tt>hash_map(size_type n)</tt></TD><TD VAlign=top> <A href="HashedAssociativeContainer.html">Hashed Associative Container</A></TD><TD VAlign=top>Creates an empty <tt>hash_map</tt> with at least <tt>n</tt> buckets.</TD></TR><TR><TD VAlign=top><pre>hash_map(size_type n,          const hasher&amp; h)</pre></TD><TD VAlign=top> <A href="HashedAssociativeContainer.html">Hashed Associative Container</A></TD><TD VAlign=top>Creates an empty <tt>hash_map</tt> with at least <tt>n</tt> buckets, using <tt>h</tt>   as the hash function.</TD></TR><TR><TD VAlign=top><pre>hash_map(size_type n,         const hasher&amp; h,          const key_equal&amp; k)</pre></TD><TD VAlign=top> <A href="HashedAssociativeContainer.html">Hashed Associative Container</A></TD><TD VAlign=top>Creates an empty <tt>hash_map</tt> with at least <tt>n</tt> buckets, using <tt>h</tt>   as the hash function and <tt>k</tt> as the key equal function.</TD></TR><TR><TD VAlign=top><pre>template &lt;class <A href="InputIterator.html">InputIterator</A>&gt;hash_map(InputIterator f, InputIterator l)<A href="#2">[2]</A></pre></TD><TD VAlign=top> <A href="UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A></TD><TD VAlign=top>Creates a hash_map with a copy of a range.</TD></TR><TR><TD VAlign=top><pre>template &lt;class <A href="InputIterator.html">InputIterator</A>&gt;hash_map(InputIterator f, InputIterator l,         size_type n)<A href="#2">[2]</A></pre></TD><TD VAlign=top> <A href="UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A></TD><TD VAlign=top>Creates a hash_map with a copy of a range and a bucket count of at   least <tt>n</tt>.</TD></TR><TR><TD VAlign=top><pre>template &lt;class <A href="InputIterator.html">InputIterator</A>&gt;hash_map(InputIterator f, InputIterator l,         size_type n, const hasher&amp; h)<A href="#2">[2]</A></pre></TD><TD VAlign=top> <A href="UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A></TD><TD VAlign=top>Creates a hash_map with a copy of a range and a bucket count of at   least <tt>n</tt>, using <tt>h</tt> as the hash function.</TD></TR><TR><TD VAlign=top><pre>template &lt;class <A href="InputIterator.html">InputIterator</A>&gt;hash_map(InputIterator f, InputIterator l,         size_type n, const hasher&amp; h,          const key_equal&amp; k)<A href="#2">[2]</A></pre></TD><TD VAlign=top> <A href="UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A></TD><TD VAlign=top>Creates a hash_map with a copy of a range and a bucket count of at   least <tt>n</tt>, using <tt>h</tt> as the hash function and <tt>k</tt> as the   key equal function.</TD></TR><TR><TD VAlign=top><tt>hash_map(const hash_map&amp;)</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>The copy constructor.</TD></TR><TR><TD VAlign=top><tt>hash_map&amp; operator=(const hash_map&amp;)</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>The assignment operator</TD></TR><TR><TD VAlign=top><tt>void swap(hash_map&amp;)</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Swaps the contents of two hash_maps.</TD></TR><TR><TD VAlign=top><pre>pair&lt;iterator, bool&gt;insert(const value_type&amp; x)</pre></TD><TD VAlign=top> <A href="UniqueAssociativeContainer.html">Unique Associative Container</A></TD><TD VAlign=top>Inserts <tt>x</tt> into the <tt>hash_map</tt>.</TD></TR><TR><TD VAlign=top><pre>template &lt;class <A href="InputIterator.html">InputIterator</A>&gt;void insert(InputIterator f, InputIterator l)<A href="#2">[2]</A></pre></TD><TD VAlign=top> <A href="UniqueAssociativeContainer.html">Unique Associative Container</A></TD><TD VAlign=top>Inserts a range into the <tt>hash_map</tt>.</TD></TR><TR><TD VAlign=top><tt>void erase(iterator pos)</tt></TD><TD VAlign=top> <A href="AssociativeContainer.html">Associative Container</A></TD><TD VAlign=top>Erases the element pointed to by <tt>pos</tt>.</TD></TR><TR><TD VAlign=top><tt>size_type erase(const key_type&amp; k)</tt></TD><TD VAlign=top> <A href="AssociativeContainer.html">Associative Container</A></TD><TD VAlign=top>Erases the element whose key is <tt>k</tt>.</TD></TR><TR><TD VAlign=top><tt>void erase(iterator first, iterator last)</tt></TD><TD VAlign=top> <A href="AssociativeContainer.html">Associative Container</A></TD><TD VAlign=top>Erases all elements in a range.</TD></TR><TR><TD VAlign=top><tt>void clear()</tt></TD><TD VAlign=top> <A href="AssociativeContainer.html">Associative Container</A></TD><TD VAlign=top>Erases all of the elements.</TD></TR><TR><TD VAlign=top><tt>const_iterator find(const key_type&amp; k) const</tt></TD><TD VAlign=top> <A href="AssociativeContainer.html">Associative Container</A></TD><TD VAlign=top>Finds an element whose key is <tt>k</tt>.</TD></TR><TR><TD VAlign=top><tt>iterator find(const key_type&amp; k)</tt></TD><TD VAlign=top> <A href="AssociativeContainer.html">Associative Container</A></TD><TD VAlign=top>Finds an element whose key is <tt>k</tt>.</TD></TR><TR><TD VAlign=top><tt>size_type count(const key_type&amp; k) const</tt></TD><TD VAlign=top> <A href="UniqueAssociativeContainer.html">Unique Associative Container</A></TD><TD VAlign=top>Counts the number of elements whose key is <tt>k</tt>.</TD></TR><TR><TD VAlign=top><pre>pair&lt;const_iterator, const_iterator&gt;equal_range(const key_type&amp; k) const</pre></TD><TD VAlign=top> <A href="AssociativeContainer.html">Associative Container</A></TD><TD VAlign=top>Finds a range containing all elements whose key is <tt>k</tt>.</TD></TR><TR><TD VAlign=top><pre>pair&lt;iterator, iterator&gt;equal_range(const key_type&amp; k)</pre></TD><TD VAlign=top> <A href="AssociativeContainer.html">Associative Container</A></TD><TD VAlign=top>Finds a range containing all elements whose key is <tt>k</tt>.</TD></TR><TR><TD VAlign=top><pre>data_type&amp; operator[](const key_type&amp; k) <A href="#3">[3]</A></pre></TD><TD VAlign=top><tt>hash_map</tt></TD><TD VAlign=top>See below.</TD></TR><TR><TD VAlign=top><pre>bool operator==(const hash_map&amp;,                 const hash_map&amp;)</pre></TD><TD VAlign=top> <A href="HashedAssociativeContainer.html">Hashed Associative Container</A></TD><TD VAlign=top>Tests two hash_maps for equality.  This is a global function,   not a member function.</TD></tr></table><h3>New members</h3>These members are not defined in the<A href="UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A> and <A href="PairAssociativeContainer.html">Pair Associative Container</A>requirements, but are specific to<tt>hash_map</tt>.<Table border><TR><TH>Member</TH><TH>Description</TH></TR><TR><TD VAlign=top><pre>data_type&amp; operator[](const key_type&amp; k) <A href="#3">[3]</A></pre></TD><TD VAlign=top>Returns a reference to the object that is associated with   a particular key.  If the <tt>hash_map</tt> does not already contain such   an object, <tt>operator[]</tt> inserts the default object <tt>data_type()</tt>. <A href="#3">[3]</A></TD></tr></table><h3>Notes</h3><P><A name="1">[1]</A><tt>Hash_map::iterator</tt> is not a mutable iterator, because<tt>hash_map::value_type</tt> is not <A href="Assignable.html">Assignable</A>.  That is, if <tt>i</tt> is oftype <tt>hash_map::iterator</tt> and <tt>p</tt> is of type<tt>hash_map::value_type</tt>, then <tt>*i = p</tt> is not a validexpression.  However, <tt>hash_map::iterator</tt> isn't a constantiterator either, because it can be used to modify the object that itpoints to.  Using the same notation as above, <tt>(*i).second = p</tt>is a valid expression.<P><A name="2">[2]</A>This member function relies on <i>member template</i> functions, whichat present (early 1998) are not supported by all compilers.  If yourcompiler supports member templates, you can call this function withany type of <A href="InputIterator.html">input iterator</A>.  If yourcompiler does not yet support member templates, though, then thearguments must either be of type <tt>const value_type*</tt> or of type<tt>hash_map::const_iterator</tt>.<P><A name="3">[3]</A>Since <tt>operator[]</tt> might insert a new element into the<tt>hash_map</tt>, it can't possibly be a <tt>const</tt> memberfunction.  Note that the definition of <tt>operator[]</tt> isextremely simple: <tt>m[k]</tt> is equivalent to<tt>(*((m.insert(value_type(k, data_type()))).first)).second</tt>.Strictly speaking, this member function is unnecessary: it exists onlyfor convenience.<h3>See also</h3><A href="AssociativeContainer.html">Associative Container</A>,<A href="HashedAssociativeContainer.html">Hashed Associative Container</A>, <A href="PairAssociativeContainer.html">Pair Associative Container</A>,<A href="UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A>, <tt><A href="set.html">set</A></tt>,<tt><A href="Map.html">map</A></tt><tt><A href="multiset.html">multiset</A></tt>,<tt><A href="Multimap.html">multimap</A></tt>,<tt><A href="hash_set.html">hash_set</A></tt>, <tt><A href="hash_multiset.html">hash_multiset</A></tt>,<tt><A href="hash_multimap.html">hash_multimap</A></tt><!-- start footer --><!-- Footer Begins --><STYLE TYPE="text/css"><!--TD.footer, TD.footer A{		font-family: Arial, helvetica, sans-serif;        	font-size: 8pt;}A.home {font-family: Arial, helvetica, sans-serif;}--></STYLE><P><A CLASS="home" HREF="index.html">STL Home</A><P><TABLE WIDTH="600" CELLPADDING="0" CELLPADDING="0" BORDER="0">	<TR>	    <TD ALIGN="RIGHT" CLASS="footer"><A HREF="/company_info/terms.html" TARGET="_top">terms of use</A> | <A HREF="/company_info/privacy.html" TARGET="_top">privacy policy</A></TD>	    <TD ALIGN="CENTER" CLASS="footer">&nbsp;|&nbsp;</TD>	    <TD ALIGN="LEFT" CLASS="footer"><A HREF="/cgi-bin/feedback/" TARGET="_top">contact us</A></TD>	</TR><TR>	    <TD ALIGN="RIGHT" CLASS="footer">Copyright &copy; 1993-2003 Silicon Graphics, Inc. All rights reserved.</TD>	    <TD ALIGN="CENTER" CLASS="footer">&nbsp;|&nbsp;</TD>	    <TD ALIGN="LEFT" CLASS="footer"><A HREF="/company_info/trademarks/" TARGET="_top">Trademark Information</A></TD>	</TR></TABLE><!-- Footer Ends --><!-- end footer --><P></BODY></HTML> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -