📄 map.html
字号:
<H3><CODE><A NAME="multimap::key_compare">multimap::key_compare</A></CODE></H3><PRE>typedef Pr <B>key_compare</B>;</PRE><P>The type describes a function object that can compare twosort keys to determine the relative order of twoelements in the controlled sequence.</P><H3><CODE><A NAME="multimap::key_type">multimap::key_type</A></CODE></H3><PRE>typedef Key <B>key_type</B>;</PRE><P>The type describes the sort key object stored in eachelement of the controlled sequence.</P><H3><CODE><A NAME="multimap::lower_bound">multimap::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 sequence for which<CODE><A HREF="#multimap::key_comp">key_comp</A>()(X.<A HREF="utility.html#pair::first">first</A>, keyval)</CODE> isfalse.</P> If no such element exists, the function returns<CODE><A HREF="#multimap::end">end</A>()</CODE>.<H3><CODE><A NAME="multimap::mapped_type">multimap::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="multimap::max_size">multimap::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="multimap::multimap">multimap::multimap</A></CODE></H3><PRE><B>multimap</B>();explicit <B>multimap</B>(const Pr& pred);<B>multimap</B>(const Pr& pred, const Alloc& al);<B>multimap</B>(const multimap& right);template<class InIt> <B>multimap</B>(InIt first, InIt last);template<class InIt> <B>multimap</B>(InIt first, InIt last, const Pr& pred);template<class InIt> <B>multimap</B>(InIt first, InIt last, const Pr& pred, const Alloc& 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="#multimap::get_allocator">get_allocator</A>()</CODE>.Otherwise, it is <CODE>Alloc()</CODE>.</P><P>All constructors also store a function object that can laterbe returned by calling<CODE><A HREF="#multimap::key_comp">key_comp</A>()</CODE>.The function object is the argument <CODE>pred</CODE>, if present.For the copy constructor, it is<CODE>right.<A HREF="#multimap::key_comp">key_comp</A>()</CODE>).Otherwise, it is <CODE>Pr()</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="multimap::pointer">multimap::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="multimap::rbegin">multimap::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="multimap::reference">multimap::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="multimap::rend">multimap::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="multimap::reverse_iterator">multimap::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="multimap::size">multimap::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="multimap::size_type">multimap::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="multimap::swap">multimap::swap</A></CODE></H3><PRE>void <B>swap</B>(multimap& right);</PRE><P>The member function swaps the controlled sequences between<CODE>*this</CODE> and <CODE>right</CODE>. If<CODE><A HREF="#multimap::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 storedfunction object of type <CODE>Pr</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="multimap::upper_bound">multimap::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 iterator that designates theearliest element <CODE>right</CODE> in the controlled sequence for which<CODE><A HREF="#multimap::key_comp">key_comp</A>()(keyval,right.<A HREF="utility.html#pair::first">first</A>)</CODE> istrue.</P> If no such element exists, the function returns<CODE><A HREF="#multimap::end">end</A>()</CODE>.<H3><CODE><A NAME="multimap::value_comp">multimap::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="multimap::value_compare">multimap::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="multimap::value_compare::comp">comp</A></CODE></B>of type <CODE><A HREF="#multimap::key_compare">key_compare</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="multimap::value_type">multimap::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="operator!="><CODE>operator!=</CODE></A></H2><PRE>template<class Key, class Ty, class Pr, class Alloc> bool <B>operator!=</B>( const map <Key, Ty, Pr, Alloc>& left, const map <Key, Ty, Pr, Alloc>& right);template<class Key, class Ty, class Pr, class Alloc> bool <B>operator!=</B>( const multimap <Key, Ty, Pr, Alloc>& left, const multimap <Key, Ty, Pr, Alloc>& right);</PRE><P>The template function returns <CODE>!(left == right)</CODE>.</P><H2><A NAME="operator=="><CODE>operator==</CODE></A></H2><PRE>template<class Key, class Ty, class Pr, class Alloc> bool <B>operator==</B>( const map <Key, Ty, Pr, Alloc>& left, const map <Key, Ty, Pr, Alloc>& right);template<class Key, class Ty, class Pr, class Alloc> bool <B>operator==</B>( const multimap <Key, Ty, Pr, Alloc>& left, const multimap <Key, Ty, Pr, Alloc>& right);</PRE><P>The first template function overloads <CODE>operator==</CODE>to compare two objects of template class<A HREF="#map"><CODE>map</CODE></A>.The second template function overloads <CODE>operator==</CODE>to compare two objects of template class<A HREF="#multimap"><CODE>multimap</CODE></A>.Both functions return<CODE>left.<A HREF="#multimap::size">size</A>() == right.size() &&<A HREF="algorith.html#equal">equal</A>(left.<A HREF="#multimap::begin">begin</A>(), left.<A HREF="#multimap::end">end</A>(), right.begin())</CODE>.</P><H2><A NAME="operator<"><CODE>operator<</CODE></A></H2><PRE>template<class Key, class Ty, class Pr, class Alloc> bool <B>operator<</B>( const map <Key, Ty, Pr, Alloc>& left, const map <Key, Ty, Pr, Alloc>& right);template<class Key, class Ty, class Pr, class Alloc> bool <B>operator<</B>( const multimap <Key, Ty, Pr, Alloc>& left, const multimap <Key, Ty, Pr, Alloc>& right);</PRE><P>The first template function overloads <CODE>operator<</CODE>to compare two objects of template class<A HREF="#map"><CODE>map</CODE></A>.The second template function overloads <CODE>operator<</CODE>to compare two objects of template class<A HREF="#multimap"><CODE>multimap</CODE></A>.Both functions return<CODE><A HREF="algorith.html#lexicographical_compare">lexicographical_compare</A>(left.<A HREF="#multimap::begin">begin</A>(), left.<A HREF="#multimap::end">end</A>(), right.begin(), right.end(),left.<A HREF="#multimap::value_comp">value_comp</A>())</CODE>.</P><H2><A NAME="operator<="><CODE>operator<=</CODE></A></H2><PRE>template<class Key, class Ty, class Pr, class Alloc> bool <B>operator<=</B>( const map <Key, Ty, Pr, Alloc>& left, const map <Key, Ty, Pr, Alloc>& right);template<class Key, class Ty, class Pr, class Alloc> bool <B>operator<=</B>( const multimap <Key, Ty, Pr, Alloc>& left, const multimap <Key, Ty, Pr, Alloc>& right);</PRE><P>The template function returns <CODE>!(right < left)</CODE>.</P><H2><A NAME="operator>"><CODE>operator></CODE></A></H2><PRE>template<class Key, class Ty, class Pr, class Alloc> bool <B>operator></B>( const map <Key, Ty, Pr, Alloc>& left, const map <Key, Ty, Pr, Alloc>& right);template<class Key, class Ty, class Pr, class Alloc> bool <B>operator></B>( const multimap <Key, Ty, Pr, Alloc>& left, const multimap <Key, Ty, Pr, Alloc>& right);</PRE><P>The template function returns <CODE>right < left</CODE>.</P><H2><A NAME="operator>="><CODE>operator>=</CODE></A></H2><PRE>template<class Key, class Ty, class Pr, class Alloc> bool <B>operator>=</B>( const map <Key, Ty, Pr, Alloc>& left, const map <Key, Ty, Pr, Alloc>& right);template<class Key, class Ty, class Pr, class Alloc> bool <B>operator!=</B>( const multimap <Key, Ty, Pr, Alloc>& left, const multimap <Key, Ty, Pr, Alloc>& right);</PRE><P>The template function returns <CODE>!(left < right)</CODE>.</P><H2><A NAME="swap"><CODE>swap</CODE></A></H2><PRE>template<class Key, class Ty, class Pr, class Alloc> void <B>swap</B>( map <Key, Ty, Pr, Alloc>& left, map <Key, Ty, Pr, Alloc>& right);template<class Key, class Ty, class Pr, class Alloc> void <B>swap</B>( multimap <Key, Ty, Pr, Alloc>& left, multimap <Key, Ty, Pr, Alloc>& right);</PRE><P>The template function executes<CODE>left.<A HREF="#map::swap">swap</A>(right)</CODE>.</P><HR><P>See also the<B><A HREF="index.html#Table of Contents">Table of Contents</A></B> and the<B><A HREF="_index.html">Index</A></B>.</P><P><I><A HREF="crit_pjp.html">Copyright</A> © 1994-2002by P.J. Plauger. Portions derived from work<A HREF="crit_hp.html">copyright</A> © 1994by Hewlett-Packard Company. All rights reserved.</I></P><!--V4.01:1125--></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -