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

📄 hash_map.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 5 页
字号:
The first element of each pair is the <B>sort key</B> and thesecond is its associated <B>value</B>.The sequence is represented in a way that permits lookup, insertion,and removal of an arbitrary element with a number of operations that can beindependent of the number of elements in the sequence (constant time).In the worst case, the number of operations isproportional to the number of elementsin the sequence (linear time). Moreover, inserting an elementinvalidates no iterators, and removing an elementinvalidates only those iterators which point at the removed element.</P><P>The object orders the sequence it controls by calling a stored<A HREF="#hash traits">hash traits</A> object of type <CODE>Tr</CODE>.You access this stored object by calling the member function<CODE><A HREF="#hash_multimap::key_comp">key_comp</A>()</CODE>.Such a traits object must behave the same as an object of class<CODE><A HREF="#hash_compare">hash_compare</A>&lt;Key, Pr&gt;</CODE>.Specifically, for all values <CODE>keyval</CODE> of type <CODE>Key</CODE>,the call <CODE>key_comp()(keyval)</CODE> yields a distributionof values of type <CODE>size_t</CODE>.Moreover, class <CODE>Pr</CODE> imposes a<A HREF="lib_stl.html#strict weak ordering">strict weak ordering</A>on sort keys of type <CODE>Key</CODE>.For any element <CODE>X</CODE> that precedes<CODE>Y</CODE> in the sequence and has the same hash value,<CODE>key_comp()(Y.<A HREF="utility.html#pair::first">first</A>,X.first)</CODE> is false. (For the default function object<CODE><A HREF="functio2.html#less">less</A>&lt;Key&gt;</CODE>,sort keys never decrease in value.)Unlike template class <CODE><A HREF="#hash_map">hash_map</A></CODE>,an object of template class <CODE>hash_multimap</CODE> does not ensure that<CODE>key_comp()(X.first, Y.first)</CODE> is true.(Keys need not be unique.)</P><P>The actual order of elements in the controlled sequence depends on thehash function, the ordering function, and the current size of the hashtable stored in the container object. You cannot determine the current sizeof the hash table, so you cannot in general predict the order of elementsin the controlled sequence. You can always be assured, however, that anysubset of elements that have<A HREF="lib_stl.html#equivalent ordering">equivalent ordering</A>are adjacent in the controlled sequence.</P><P>The object allocates and frees storage for the sequence it controlsthrough a stored <A HREF="memory.html#allocator object">allocator object</A>of class <CODE>Alloc</CODE>. Such an allocator object must havethe same external interface as an object of template class<A HREF="memory.html#allocator"><CODE>allocator</CODE></A>.Note that the stored allocator object is <I>not</I> copied when the containerobject is assigned.</P><H3><CODE><A NAME="hash_multimap::allocator_type">hash_multimap::allocator_type</A></CODE></H3><PRE>typedef Alloc <B>allocator_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Alloc</CODE>.</P><H3><CODE><A NAME="hash_multimap::begin">hash_multimap::begin</A></CODE></H3><PRE>const_iterator <B>begin</B>() const;iterator <B>begin</B>();</PRE><P>The member function returns a bidirectional iterator that points atthe first element of the sequence (or just beyond the end of an emptysequence).</P><H3><CODE><A NAME="hash_multimap::clear">hash_multimap::clear</A></CODE></H3><PRE>void <B>clear</B>();</PRE><P>The member function calls<CODE><A HREF="#hash_multimap::erase">erase</A>(<A HREF="#hash_multimap::begin">begin</A>(),<A HREF="#hash_multimap::end">end</A>())</CODE>.</P><H3><CODE><A NAME="hash_multimap::const_iterator">hash_multimap::const_iterator</A></CODE></H3><PRE>typedef T1 <B>const_iterator</B>;</PRE><P>The type describes an object that can serve as a constantbidirectional iterator for the controlled sequence.It is described here as asynonym for the implementation-defined type <CODE>T1</CODE>.</P><H3><CODE><A NAME="hash_multimap::const_pointer">hash_multimap::const_pointer</A></CODE></H3><PRE>typedef Alloc::const_pointer <B>const_pointer</B>;</PRE><P>The type describes an object that can serve as a constant pointerto an element of the controlled sequence.</P><H3><CODE><A NAME="hash_multimap::const_reference">hash_multimap::const_reference</A></CODE></H3><PRE>typedef Alloc::const_reference <B>const_reference</B>;</PRE><P>The type describes an object that can serve as a constant referenceto an element of the controlled sequence.</P><H3><CODE><A NAME="hash_multimap::const_reverse_iterator">hash_multimap::const_reverse_iterator</A></CODE></H3><PRE>typedef reverse_iterator&lt;const_iterator&gt;    <B>const_reverse_iterator</B>;</PRE><P>The type describes an object that can serve as a constant reversebidirectional iterator for the controlled sequence.</P><H3><CODE><A NAME="hash_multimap::count">hash_multimap::count</A></CODE></H3><PRE>size_type <B>count</B>(const Key&amp; keyval) const;</PRE><P>The member function returns the number of elements in the range<CODE>[<A HREF="#hash_multimap::lower_bound">lower_bound</A>(keyval),<A HREF="#hash_multimap::upper_bound">upper_bound</A>(keyval)).</CODE></P><H3><CODE><A NAME="hash_multimap::difference_type">hash_multimap::difference_type</A></CODE></H3><PRE>typedef T3 <B>difference_type</B>;</PRE><P>The signed integer type describes an object that can represent thedifference between the addresses of any two elements in the controlledsequence. It is described here as asynonym for the implementation-defined type <CODE>T3</CODE>.</P><H3><CODE><A NAME="hash_multimap::empty">hash_multimap::empty</A></CODE></H3><PRE>bool <B>empty</B>() const;</PRE><P>The member function returns true for an empty controlled sequence.</P><H3><CODE><A NAME="hash_multimap::end">hash_multimap::end</A></CODE></H3><PRE>const_iterator <B>end</B>() const;iterator <B>end</B>();</PRE><P>The member function returns a bidirectional iterator that pointsjust beyond the end of the sequence.</P><H3><CODE><A NAME="hash_multimap::equal_range">hash_multimap::equal_range</A></CODE></H3><PRE>pair&lt;iterator, iterator&gt; <B>equal_range</B>(const Key&amp; keyval);pair&lt;const_iterator, const_iterator&gt;    <B>equal_range</B>(const Key&amp; keyval) const;</PRE><P>The member function returns a pair of iterators <CODE>X</CODE>such that <CODE>X.<A HREF="utility.html#pair::first">first</A> ==<A HREF="#hash_multimap::lower_bound">lower_bound</A>(keyval)</CODE>and <CODE>X.<A HREF="utility.html#pair::second">second</A> ==<A HREF="#hash_multimap::upper_bound">upper_bound</A>(keyval)</CODE>.</P><H3><CODE><A NAME="hash_multimap::erase">hash_multimap::erase</A></CODE></H3><PRE>iterator <B>erase</B>(iterator where);iterator <B>erase</B>(iterator first, iterator last);size_type <B>erase</B>(const Key&amp; keyval);</PRE><P>The first member function removes the element of the controlledsequence pointed to by <CODE>where</CODE>.The second member function removes the elementsin the range <CODE>[first, last)</CODE>.Both return an iterator that designates the first element remainingbeyond any elements removed, or<CODE><A HREF="#hash_multimap::end">end</A>()</CODE> if no such element exists.</P><P>The third member removesthe elements with sort keys in the range<CODE>[<A HREF="#hash_multimap::lower_bound">lower_bound</A>(keyval),<A HREF="#hash_multimap::upper_bound">upper_bound</A>(keyval)).</CODE>It returns the number of elements it removes.</P><P>The member functions never throw an exception.</P><H3><CODE><A NAME="hash_multimap::find">hash_multimap::find</A></CODE></H3><PRE>iterator <B>find</B>(const Key&amp; keyval);const_iterator <B>find</B>(const Key&amp; keyval) const;</PRE><P>The member function returns<CODE><A HREF="#hash_multimap::lower_bound">lower_bound</A>(keyval)</CODE>.</P><H3><CODE><A NAME="hash_multimap::get_allocator">hash_multimap::get_allocator</A></CODE></H3><PRE>Alloc <B>get_allocator</B>() const;</PRE><P>The member function returns the stored<A HREF="memory.html#allocator object">allocator object</A>.</P><H3><CODE><A NAME="hash_multimap::hash_multimap">hash_multimap::hash_multimap</A></CODE></H3><PRE><B>hash_multimap</B>();explicit <B>hash_multimap</B>(const Tr&amp; traits);<B>hash_multimap</B>(const Tr&amp; traits, const Alloc&amp; al);<B>hash_multimap</B>(const hash_multimap&amp; right);template&lt;class InIt&gt;    <B>hash_multimap</B>(InIt first, InIt last);template&lt;class InIt&gt;    <B>hash_multimap</B>(InIt first, InIt last,        const Tr&amp; traits);template&lt;class InIt&gt;    <B>hash_multimap</B>(InIt first, InIt last,        const Tr&amp; traits, const Alloc&amp; al);</PRE><P>All constructors store an<A HREF="memory.html#allocator object">allocator object</A> andinitialize the controlled sequence. The allocator object is the argument<CODE>al</CODE>, if present. For the copy constructor, it is<CODE>right.<A HREF="#hash_multimap::get_allocator">get_allocator</A>()</CODE>.Otherwise, it is <CODE>Alloc()</CODE>.</P><P>All constructors also store a<A HREF="#hash traits">hash traits</A> object that can laterbe returned by calling<CODE><A HREF="#hash_multimap::key_comp">key_comp</A>()</CODE>.The hash traits object is the argument <CODE>traits</CODE>, if present.For the copy constructor, it is<CODE>right.<A HREF="#hash_multimap::key_comp">key_comp</A>()</CODE>).Otherwise, it is <CODE>Tr()</CODE>.</P><P>The first three constructors specify anempty initial controlled sequence. The fourth constructor specifiesa copy of the sequence controlled by <CODE>right</CODE>.The last three constructors specify the sequence of element values<CODE>[first, last)</CODE>.</P><H3><CODE><A NAME="hash_multimap::insert">hash_multimap::insert</A></CODE></H3><PRE>iterator <B>insert</B>(const value_type&amp; val);iterator <B>insert</B>(iterator where, const value_type&amp; val);template&lt;class InIt&gt;    void <B>insert</B>(InIt first, InIt last);</PRE><P>The first member function inserts the element <CODE>val</CODE>in the controlled sequence, then returnsthe iterator that designates the inserted element.The second member function returns <CODE>insert(val)</CODE>,using <CODE>where</CODE> as a starting place within the controlledsequence to search for the insertion point. (Insertion canpossibly occur somewhat faster, if theinsertion point immediately precedes or follows <CODE>where</CODE>.)The third member functioninserts the sequence of element values,for each <CODE>where</CODE> in the range <CODE>[first, last)</CODE>,by calling <CODE>insert(*where)</CODE>.</P><P>If an exception is thrown during theinsertion of a single element, the container is left unalteredand the exception is rethrown.If an exception is thrown during theinsertion of multiple elements, the container is left in a stablebut unspecified state and the exception is rethrown.</P><H3><CODE><A NAME="hash_multimap::iterator">hash_multimap::iterator</A></CODE></H3><PRE>typedef T0 <B>iterator</B>;</PRE><P>The type describes an object that can serve as a bidirectionaliterator for the controlled sequence.It is described here as asynonym for the implementation-defined type <CODE>T0</CODE>.</P><H3><CODE><A NAME="hash_multimap::key_comp">hash_multimap::key_comp</A></CODE></H3><PRE>key_compare <B>key_comp</B>() const;</PRE><P>The member function returns the stored<A HREF="#hash traits">hash traits</A> object thatdetermines the order of elements in the controlled sequence.In particular, the stored object defines the member function:</P><PRE>bool operator()(const Key&amp; left, const Key&amp; right);</PRE><P>which returns true if <CODE>left</CODE> strictlyprecedes <CODE>right</CODE> in the sort order.</P><H3><CODE><A NAME="hash_multimap::key_compare">hash_multimap::key_compare</A></CODE></H3><PRE>typedef Tr <B>key_compare</B>;</PRE><P>The type describes a traits object that behaves much like an object of class

⌨️ 快捷键说明

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