📄 hash_map.html
字号:
<P>The type describes the sort key object stored in eachelement of the controlled sequence.</P><H3><CODE><A NAME="hash_map::lower_bound">hash_map::lower_bound</A></CODE></H3><PRE>iterator <B>lower_bound</B>(const Key& keyval);const_iterator <B>lower_bound</B>(const Key& keyval) const;</PRE><P>The member function returns an iterator that designates theearliest element <CODE>X</CODE> in the controlled sequencefor which <CODE>X.<A HREF="utility.html#pair::first">first</A></CODE> has<A HREF="lib_stl.html#equivalent ordering">equivalent ordering</A>to <CODE>keyval</CODE>.If no such element exists, the function returns<CODE><A HREF="#hash_map::end">end</A>()</CODE>.<H3><CODE><A NAME="hash_map::mapped_type">hash_map::mapped_type</A></CODE></H3><PRE>typedef Ty <B>mapped_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Ty</CODE>.</P><H3><CODE><A NAME="hash_map::max_size">hash_map::max_size</A></CODE></H3><PRE>size_type <B>max_size</B>() const;</PRE><P>The member function returns the length of the longest sequence thatthe object can control.</P><H3><CODE><A NAME="hash_map::operator[]">hash_map::operator[]</A></CODE></H3><PRE>Ty& <B>operator[]</B>(const Key& keyval);</PRE><P>The member function determines the iterator <CODE>where</CODE>as the return value of<CODE><A HREF="#hash_map::insert">insert</A>(<A HREF="#hash_map::value_type">value_type</A>(keyval, Ty())</CODE>.(It inserts an element with the specified key if no such elementexists.) It then returns a reference to<CODE>(*where).<A HREF="utility.html#pair::second">second</A></CODE>.</P><H3><CODE><A NAME="hash_map::pointer">hash_map::pointer</A></CODE></H3><PRE>typedef Alloc::pointer <B>pointer</B>;</PRE><P>The type describes an object that can serve as a pointer to anelement of the controlled sequence.</P><H3><CODE><A NAME="hash_map::rbegin">hash_map::rbegin</A></CODE></H3><PRE>const_reverse_iterator <B>rbegin</B>() const;reverse_iterator <B>rbegin</B>();</PRE><P>The member function returns a reverse bidirectionaliterator that points justbeyond the end of the controlled sequence. Hence, it designates thebeginning of the reverse sequence.</P><H3><CODE><A NAME="hash_map::reference">hash_map::reference</A></CODE></H3><PRE>typedef Alloc::reference <B>reference</B>;</PRE><P>The type describes an object that can serve as a reference to anelement of the controlled sequence.</P><H3><CODE><A NAME="hash_map::rend">hash_map::rend</A></CODE></H3><PRE>const_reverse_iterator <B>rend</B>() const;reverse_iterator <B>rend</B>();</PRE><P>The member function returns a reverse bidirectionaliterator that points at thefirst element of the sequence (or just beyond the end of an emptysequence). Hence, it designates the end of the reverse sequence.</P><H3><CODE><A NAME="hash_map::reverse_iterator">hash_map::reverse_iterator</A></CODE></H3><PRE>typedef reverse_iterator<iterator> <B>reverse_iterator</B>;</PRE><P>The type describes an object that can serve as a reversebidirectional iterator for the controlled sequence.</P><H3><CODE><A NAME="hash_map::size">hash_map::size</A></CODE></H3><PRE>size_type <B>size</B>() const;</PRE><P>The member function returns the length of the controlled sequence.</P><H3><CODE><A NAME="hash_map::size_type">hash_map::size_type</A></CODE></H3><PRE>typedef T2 <B>size_type</B>;</PRE><P>The unsigned integer type describes an object that can represent thelength of any controlled sequence. It is described here as asynonym for the implementation-defined type <CODE>T2</CODE>.</P><H3><CODE><A NAME="hash_map::swap">hash_map::swap</A></CODE></H3><PRE>void <B>swap</B>(hash_map& right);</PRE><P>The member function swaps the controlled sequences between<CODE>*this</CODE> and <CODE>right</CODE>. If<CODE><A HREF="#hash_map::get_allocator">get_allocator</A>()== right.get_allocator()</CODE>, it does so in constant time,it throws an exception only as a result of copying the storedtraits object of type <CODE>Tr</CODE>, and it invalidates no references, pointers,or iterators that designate elements in the two controlled sequences.Otherwise, it performs a number of element assignments and constructor callsproportional to the number of elements in the two controlled sequences.</P><H3><CODE><A NAME="hash_map::upper_bound">hash_map::upper_bound</A></CODE></H3><PRE>iterator <B>upper_bound</B>(const Key& keyval);const_iterator <B>upper_bound</B>(const Key& keyval) const;</PRE><P>The member function returns an iteratorjust beyond the iterator that designates thelatest element <CODE>X</CODE> in the controlled sequencefor which <CODE>X.<A HREF="utility.html#pair::first">first</A></CODE> has<A HREF="lib_stl.html#equivalent ordering">equivalent ordering</A>to <CODE>keyval</CODE>.If no such element exists, the function returns<CODE><A HREF="#hash_map::end">end</A>()</CODE>.<H3><CODE><A NAME="hash_map::value_comp">hash_map::value_comp</A></CODE></H3><PRE>value_compare <B>value_comp</B>() const;</PRE><P>The member function returns a function object thatdetermines the order of elements in the controlled sequence.</P><H3><CODE><A NAME="hash_map::value_compare">hash_map::value_compare</A></CODE></H3><PRE>class <B>value_compare</B> : public <A HREF="functio2.html#binary_function">binary_function</A><value_type, value_type, bool> {public: bool operator()(const value_type& left, const value_type& right) const {return (comp(left.first, right.first)); }protected: value_compare(key_compare pr) : comp(pr) {} key_compare comp; };</PRE><P>The type describes a function object that can compare thesort keys in two elements to determine their relative orderin the controlled sequence. The function object stores an object<B><CODE><A NAME="hash_map::value_compare::comp">comp</A></CODE></B>of type <CODE><A HREF="#hash_map::key_type">key_type</A></CODE>.The member function <B><CODE>operator()</CODE></B> uses thisobject to compare the sort-key components of two element.</P><H3><CODE><A NAME="hash_map::value_type">hash_map::value_type</A></CODE></H3><PRE>typedef <A HREF="utility.html#pair">pair</A><const Key, Ty> <B>value_type</B>;</PRE><P>The type describes an element of the controlled sequence.</P><H2><A NAME="hash_multimap"><CODE>hash_multimap</CODE></A></H2><HR><P><B><CODE><A HREF="#hash_multimap::allocator_type">allocator_type</A>· <A HREF="#hash_multimap::begin">begin</A>· <A HREF="#hash_multimap::clear">clear</A>· <A HREF="#hash_multimap::const_iterator">const_iterator</A>· <A HREF="#hash_multimap::const_pointer">const_pointer</A>· <A HREF="#hash_multimap::const_reference">const_reference</A>· <A HREF="#hash_multimap::const_reverse_iterator">const_reverse_iterator</A>· <A HREF="#hash_multimap::count">count</A>· <A HREF="#hash_multimap::difference_type">difference_type</A>· <A HREF="#hash_multimap::empty">empty</A>· <A HREF="#hash_multimap::end">end</A>· <A HREF="#hash_multimap::equal_range">equal_range</A>· <A HREF="#hash_multimap::erase">erase</A>· <A HREF="#hash_multimap::find">find</A>· <A HREF="#hash_multimap::get_allocator">get_allocator</A>· <A HREF="#hash_multimap::insert">insert</A>· <A HREF="#hash_multimap::iterator">iterator</A>· <A HREF="#hash_multimap::key_comp">key_comp</A>· <A HREF="#hash_multimap::key_compare">key_compare</A>· <A HREF="#hash_multimap::key_type">key_type</A>· <A HREF="#hash_multimap::lower_bound">lower_bound</A>· <A HREF="#hash_multimap::mapped_type">mapped_type</A>· <A HREF="#hash_multimap::max_size">max_size</A>· <A HREF="#hash_multimap::hash_multimap">hash_multimap</A>· <A HREF="#hash_multimap::rbegin">rbegin</A>· <A HREF="#hash_multimap::reference">reference</A>· <A HREF="#hash_multimap::rend">rend</A>· <A HREF="#hash_multimap::reverse_iterator">reverse_iterator</A>· <A HREF="#hash_multimap::size">size</A>· <A HREF="#hash_multimap::size_type">size_type</A>· <A HREF="#hash_multimap::swap">swap</A>· <A HREF="#hash_multimap::upper_bound">upper_bound</A>· <A HREF="#hash_multimap::value_comp">value_comp</A>· <A HREF="#hash_multimap::value_compare">value_compare</A>· <A HREF="#hash_multimap::value_type">value_type</A></CODE></B></P><HR><PRE>template<class Key, class Ty, class Tr = hash_compare<Key, less<Key> >, class Alloc = allocator<pair<const Key, Ty> > > class <B>hash_multimap</B> {public: typedef Key <B><A HREF="#hash_multimap::key_type">key_type</A></B>; typedef Ty <B><A HREF="#hash_multimap::mapped_type">mapped_type</A></B>; typedef Tr <B><A HREF="#hash_multimap::key_compare">key_compare</A></B>; typedef Alloc <B><A HREF="#hash_multimap::allocator_type">allocator_type</A></B>; typedef pair<const Key, Ty> <B><A HREF="#hash_multimap::value_type">value_type</A></B>; class <B><A HREF="#hash_multimap::value_compare">value_compare</A></B>; typedef Alloc::pointer <B><A HREF="#hash_multimap::pointer">pointer</A></B>; typedef Alloc::const_pointer <B><A HREF="#hash_multimap::const_pointer">const_pointer</A></B>; typedef Alloc::reference <B><A HREF="#hash_multimap::reference">reference</A></B>; typedef Alloc::const_reference <B><A HREF="#hash_multimap::const_reference">const_reference</A></B>; typedef T0 <B><A HREF="#hash_multimap::iterator">iterator</A></B>; typedef T1 <B><A HREF="#hash_multimap::const_iterator">const_iterator</A></B>; typedef T2 <B><A HREF="#hash_multimap::size_type">size_type</A></B>; typedef T3 <B><A HREF="#hash_multimap::difference_type">difference_type</A></B>; typedef reverse_iterator<const_iterator> <B><A HREF="#hash_multimap::const_reverse_iterator">const_reverse_iterator</A></B>; typedef reverse_iterator<iterator> <B><A HREF="#hash_multimap::reverse_iterator">reverse_iterator</A></B>; <B><A HREF="#hash_multimap::hash_multimap">hash_multimap</A></B>(); explicit <B><A HREF="#hash_multimap::hash_multimap">hash_multimap</A></B>(const Tr& traits); <B><A HREF="#hash_multimap::hash_multimap">hash_multimap</A></B>(const Tr& traits, const Alloc& al); <B><A HREF="#hash_multimap::hash_multimap">hash_multimap</A></B>(const hash_multimap& right); template<class InIt> <B><A HREF="#hash_multimap::hash_multimap">hash_multimap</A></B>(InIt first, InIt last); template<class InIt> <B><A HREF="#hash_multimap::hash_multimap">hash_multimap</A></B>(InIt first, InIt last, const Tr& traits); template<class InIt> <B><A HREF="#hash_multimap::hash_multimap">hash_multimap</A></B>(InIt first, InIt last, const Tr& traits, const Alloc& al); iterator <B><A HREF="#hash_multimap::begin">begin</A></B>(); const_iterator <B><A HREF="#hash_multimap::begin">begin</A></B>() const; iterator <B><A HREF="#hash_multimap::end">end</A></B>(); const_iterator <B><A HREF="#hash_multimap::end">end</A></B>() const; reverse_iterator <B><A HREF="#hash_multimap::rbegin">rbegin</A></B>(); const_reverse_iterator <B><A HREF="#hash_multimap::rbegin">rbegin</A></B>() const; reverse_iterator <B><A HREF="#hash_multimap::rend">rend</A></B>(); const_reverse_iterator <B><A HREF="#hash_multimap::rend">rend</A></B>() const; size_type <B><A HREF="#hash_multimap::size">size</A></B>() const; size_type <B><A HREF="#hash_multimap::max_size">max_size</A></B>() const; bool <B><A HREF="#hash_multimap::empty">empty</A></B>() const; Alloc <B><A HREF="#hash_multimap::get_allocator">get_allocator</A></B>() const; iterator <B><A HREF="#hash_multimap::insert">insert</A></B>(const value_type& val); iterator <B><A HREF="#hash_multimap::insert">insert</A></B>(iterator where, const value_type& val); template<class InIt> void <B><A HREF="#hash_multimap::insert">insert</A></B>(InIt first, InIt last); iterator <B><A HREF="#hash_multimap::erase">erase</A></B>(iterator where); iterator <B><A HREF="#hash_multimap::erase">erase</A></B>(iterator first, iterator last); size_type <B><A HREF="#hash_multimap::erase">erase</A></B>(const Key& keyval); void <B><A HREF="#hash_multimap::clear">clear</A></B>(); void <B><A HREF="#hash_multimap::swap">swap</A></B>(hash_multimap& right); key_compare <B><A HREF="#hash_multimap::key_comp">key_comp</A></B>() const; value_compare <B><A HREF="#hash_multimap::value_comp">value_comp</A></B>() const; iterator <B><A HREF="#hash_multimap::find">find</A></B>(const Key& keyval); const_iterator <B><A HREF="#hash_multimap::find">find</A></B>(const Key& keyval) const; size_type <B><A HREF="#hash_multimap::count">count</A></B>(const Key& keyval) const; iterator <B><A HREF="#hash_multimap::lower_bound">lower_bound</A></B>(const Key& keyval); const_iterator <B><A HREF="#hash_multimap::lower_bound">lower_bound</A></B>(const Key& keyval) const; iterator <B><A HREF="#hash_multimap::upper_bound">upper_bound</A></B>(const Key& keyval); const_iterator <B><A HREF="#hash_multimap::upper_bound">upper_bound</A></B>(const Key& keyval) const; pair<iterator, iterator> <B><A HREF="#hash_multimap::equal_range">equal_range</A></B>(const Key& keyval); pair<const_iterator, const_iterator> <B><A HREF="#hash_multimap::equal_range">equal_range</A></B>(const Key& keyval) const; };</PRE><P>The template class describes an object that controls avarying-length sequence of elements of type<CODE><A HREF="utility.html#pair">pair</A><const Key, Ty></CODE>.The sequence is<A HREF="lib_stl.html#sequence ordering">ordered by</A> the<A HREF="#hash traits">hash traits</A> object<CODE>Tr</CODE>, which includes both a two-operand function for imposing a<A HREF="lib_stl.html#strict weak ordering">strict weak ordering</A>and a one-operand <A HREF="#hash function">hash function</A>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -