📄 hash_multiset.html
字号:
<HTML><!-- -- Copyright (c) 1996-1999 -- Silicon Graphics Computer Systems, Inc. -- -- Permission to use, copy, modify, distribute and sell this software -- and its documentation for any purpose is hereby granted without fee, -- provided that the above copyright notice appears in all copies and -- that both that copyright notice and this permission notice appear -- in supporting documentation. Silicon Graphics makes no -- representations about the suitability of this software for any -- purpose. It is provided "as is" without express or implied warranty. -- -- Copyright (c) 1994 -- Hewlett-Packard Company -- -- Permission to use, copy, modify, distribute and sell this software -- and its documentation for any purpose is hereby granted without fee, -- provided that the above copyright notice appears in all copies and -- that both that copyright notice and this permission notice appear -- in supporting documentation. Hewlett-Packard Company makes no -- representations about the suitability of this software for any -- purpose. It is provided "as is" without express or implied warranty. -- --><Head><Title>hash_multiset<Key, HashFcn, EqualKey, Alloc></Title><!-- Generated by htmldoc --></HEAD><BODY TEXT="#000000" LINK="#006600" ALINK="#003300" VLINK="#7C7F87" BGCOLOR="#FFFFFF"><A HREF="/"><IMG SRC="/images/common/sgilogo_small.gif" ALT="SGI Logo" WIDTH="80" HEIGHT="72" BORDER="0"></A><P><!--end header--><BR Clear><H1>hash_multiset<Key, HashFcn, EqualKey, Alloc></H1><Table CellPadding=0 CellSpacing=0 width=100%><TR><TD Align=left><Img src = "containers.gif" Alt="" WIDTH = "194" HEIGHT = "38" ></TD><TD Align=right><Img src = "type.gif" Alt="" WIDTH = "194" HEIGHT = "38" ></TD></TR><TR><TD Align=left VAlign=top><b>Category</b>: containers</TD><TD Align=right VAlign=top><b>Component type</b>: type</TD></TR></Table><h3>Description</h3><tt>Hash_multiset</tt> is a<A href="HashedAssociativeContainer.html">Hashed Associative Container</A>that stores objects of type <tt>Key</tt>.<tt>Hash_multiset</tt> is a<A href="SimpleAssociativeContainer.html">simple associative container</A>,meaning that its value type, as well as its key type,is <tt>Key</tt>. It is also a<A href="MultipleAssociativeContainer.html">Multiple Associative Container</A>,meaning that two or more elements may compare equalusing the <A href="BinaryPredicate.html">Binary Predicate</A><tt>EqualKey</tt>.<P><tt>Hash_multiset</tt> is useful in applications where it is importantto be able to search for an element quickly. If it is important forthe elements to be in a particular order, however, then<tt><A href="multiset.html">multiset</A></tt> is more appropriate.<h3>Example</h3><pre>struct eqstr{ bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) == 0; }};void lookup(const hash_multiset<const char*, hash<const char*>, eqstr>& Set, const char* word){ int n_found = Set.count(word); cout << word << ": " << n_found << " " << (n_found == 1 ? "instance" : "instances") << endl;}int main(){ hash_multiset<const char*, hash<const char*>, eqstr> Set; Set.insert("mango"); Set.insert("kiwi"); Set.insert("apple"); Set.insert("kiwi"); Set.insert("mango"); Set.insert("mango"); Set.insert("apricot"); Set.insert("banana"); Set.insert("mango"); lookup(Set, "mango"); lookup(Set, "apple"); lookup(Set, "durian");}</pre><h3>Definition</h3>Defined in the header <A href="hash_set">hash_set</A>, and in the backward-compatibilityheader <A href="hash_set.h">hash_set.h</A>. This class is an SGI extension; it is not partof the C++ standard.<h3>Template parameters</h3><Table border><TR><TH>Parameter</TH><TH>Description</TH><TH>Default</TH></TR><TR><TD VAlign=top><tt>Key</tt></TD><TD VAlign=top>The hash_multiset's key type and value type. This is also defined as <tt>hash_multiset::key_type</tt> and <tt>hash_multiset::value_type</tt></TD><TD VAlign=top> </TD></TR><TR><TD VAlign=top><tt>HashFcn</tt></TD><TD VAlign=top>The <A href="HashFunction.html">Hash Function</A> used by the hash_multiset. This is also defined as <tt>hash_multiset::hasher</tt>. </TD><TD VAlign=top><tt><A href="hash.html">hash</A><Key></tt></TD></TR><TR><TD VAlign=top><tt>EqualKey</tt></TD><TD VAlign=top>The hash_multiset's key equality function: a <A href="BinaryPredicate.html">binary predicate</A> that determines whether two keys are equal. This is also defined as <tt>hash_multiset::key_equal</tt>.</TD><TD VAlign=top><tt><A href="equal_to.html">equal_to</A><Key></tt></TD></TR><TR><TD VAlign=top><tt>Alloc</tt></TD><TD VAlign=top>The <tt>hash_multiset</tt>'s allocator, used for all internal memory management.</TD><TD VAlign=top><tt><A href="Allocators.html">alloc</A></tt></TD></tr></table><h3>Model of</h3><A href="MultipleHashedAssociativeContainer.html">Multiple Hashed Associative Container</A>,<A href="SimpleAssociativeContainer.html">Simple Associative Container</A><h3>Type requirements</h3><UL><LI><tt>Key</tt> is <A href="Assignable.html">assignable</A>.<LI><tt>EqualKey</tt> is a <A href="BinaryPredicate.html">Binary Predicate</A> whose argument type is <tt>Key</tt>.<LI><tt>EqualKey</tt> is an equivalence relation.<LI><tt>Alloc</tt> is an <A href="Allocators.html">Allocator</A>.</UL><h3>Public base classes</h3>None.<h3>Members</h3><Table border><TR><TH>Member</TH><TH>Where defined</TH><TH>Description</TH></TR><TR><TD VAlign=top><tt>value_type</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>The type of object, <tt>T</tt>, stored in the hash_multiset.</TD></TR><TR><TD VAlign=top><tt>key_type</tt></TD><TD VAlign=top> <A href="AssociativeContainer.html">Associative Container</A></TD><TD VAlign=top>The key type associated with <tt>value_type</tt>.</TD></TR><TR><TD VAlign=top><tt>hasher</tt></TD><TD VAlign=top> <A href="HashedAssociativeContainer.html">Hashed Associative Container</A></TD><TD VAlign=top>The <tt>hash_multiset</tt>'s <A href="HashFunction.html">Hash Function</A>.</TD></TR><TR><TD VAlign=top><tt>key_equal</tt></TD><TD VAlign=top> <A href="HashedAssociativeContainer.html">Hashed Associative Container</A></TD><TD VAlign=top> <A href="functors.html">Function object</A> that compares keys for equality.</TD></TR><TR><TD VAlign=top><tt>pointer</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Pointer to <tt>T</tt>.</TD></TR><TR><TD VAlign=top><tt>reference</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Reference to <tt>T</tt></TD></TR><TR><TD VAlign=top><tt>const_reference</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Const reference to <tt>T</tt></TD></TR><TR><TD VAlign=top><tt>size_type</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>An unsigned integral type.</TD></TR><TR><TD VAlign=top><tt>difference_type</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>A signed integral type.</TD></TR><TR><TD VAlign=top><tt>iterator</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Iterator used to iterate through a <tt>hash_multiset</tt>.</TD></TR><TR><TD VAlign=top><tt>const_iterator</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Const iterator used to iterate through a <tt>hash_multiset</tt>. (<tt>Iterator</tt> and <tt>const_iterator</tt> are the same type.)</TD></TR><TR><TD VAlign=top><tt>iterator begin() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns an <tt>iterator</tt> pointing to the beginning of the <tt>hash_multiset</tt>.</TD></TR><TR><TD VAlign=top><tt>iterator end() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns an <tt>iterator</tt> pointing to the end of the <tt>hash_multiset</tt>.</TD></TR><TR><TD VAlign=top><tt>size_type size() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns the size of the <tt>hash_multiset</tt>.</TD></TR><TR><TD VAlign=top><tt>size_type max_size() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns the largest possible size of the <tt>hash_multiset</tt>.</TD></TR><TR><TD VAlign=top><tt>bool empty() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top><tt>true</tt> if the <tt>hash_multiset</tt>'s size is <tt>0</tt>.</TD></TR><TR><TD VAlign=top><tt>size_type bucket_count() const</tt></TD><TD VAlign=top> <A href="HashedAssociativeContainer.html">Hashed Associative Container</A>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -