📄 hash_set.html
字号:
to <CODE>val</CODE>. If not, it creates suchan element <CODE>X</CODE> and initializes it with <CODE>val</CODE>.The function then determines the iterator <CODE>where</CODE> thatdesignates <CODE>X</CODE>. If an insertion occurred, the functionreturns <CODE><A HREF="utility.html#pair">pair</A>(where, true)</CODE>.Otherwise, it returns <CODE>pair(where, false)</CODE>.</P><P>The second member function returns <CODE>insert(val).first</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_set::iterator">hash_set::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_set::key_comp">hash_set::key_comp</A></CODE></H3><PRE>key_compare <B>key_comp</B>() const;</PRE><P>The member function returns the stored<A HREF="hash_map.html#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& left, const Key& right);</PRE><P>which returns true if <CODE>left</CODE> strictlyprecedes <CODE>right</CODE> in the sort order.</P><H3><CODE><A NAME="hash_set::key_compare">hash_set::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<CODE><A HREF="hash_map.html#hash_compare">hash_compare</A><Key, Pr></CODE>.In particular, it can compare twosort keys to determine the relative order of twoelements in the controlled sequence.</P><H3><CODE><A NAME="hash_set::key_type">hash_set::key_type</A></CODE></H3><PRE>typedef Key <B>key_type</B>;</PRE><P>The type describes the sort key object which constitutes eachelement of the controlled sequence.</P><H3><CODE><A NAME="hash_set::lower_bound">hash_set::lower_bound</A></CODE></H3><PRE>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</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_set::end">end</A>()</CODE>.<H3><CODE><A NAME="hash_set::max_size">hash_set::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_set::pointer">hash_set::pointer</A></CODE></H3><PRE>typedef Alloc::const_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_set::rbegin">hash_set::rbegin</A></CODE></H3><PRE>const_reverse_iterator <B>rbegin</B>() const;</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_set::reference">hash_set::reference</A></CODE></H3><PRE>typedef Alloc::const_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_set::rend">hash_set::rend</A></CODE></H3><PRE>const_reverse_iterator <B>rend</B>() const;</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_set::reverse_iterator">hash_set::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_set::size">hash_set::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_set::size_type">hash_set::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_set::swap">hash_set::swap</A></CODE></H3><PRE>void <B>swap</B>(hash_set& right);</PRE><P>The member function swaps the controlled sequences between<CODE>*this</CODE> and <CODE>right</CODE>. If<CODE><A HREF="#hash_set::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_set::upper_bound">hash_set::upper_bound</A></CODE></H3><PRE>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</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_set::end">end</A>()</CODE>.<H3><CODE><A NAME="hash_set::value_comp">hash_set::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_set::value_compare">hash_set::value_compare</A></CODE></H3><PRE>typedef Tr <B>value_compare</B>;</PRE><P>The type describes a function object that can compare twoelements as sort keys to determine their relative orderin the controlled sequence.</P><H3><CODE><A NAME="hash_set::value_type">hash_set::value_type</A></CODE></H3><PRE>typedef Key <B>value_type</B>;</PRE><P>The type describes an element of the controlled sequence.</P><H2><A NAME="swap"><CODE>swap</CODE></A></H2><PRE>template<class Key, class Tr, class Alloc> void <B>swap</B>( hash_multiset <Key, Tr, Alloc>& left, hash_multiset <Key, Tr, Alloc>& right);template<class Key, class Tr, class Alloc> void <B>swap</B>( hash_set <Key, Tr, Alloc>& left, hash_set <Key, Tr, Alloc>& right);</PRE><P>The template function executes<CODE>left.<A HREF="#hash_set::swap">swap</A>(right)</CODE>.</P><H2><A NAME="operator!="><CODE>operator!=</CODE></A></H2><PRE>template<class Key, class Tr, class Alloc> bool <B>operator!=</B>( const hash_set <Key, Tr, Alloc>& left, const hash_set <Key, Tr, Alloc>& right);template<class Key, class Tr, class Alloc> bool <B>operator!=</B>( const hash_multiset <Key, Tr, Alloc>& left, const hash_multiset <Key, Tr, 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 Tr, class Alloc> bool <B>operator==</B>( const hash_set <Key, Tr, Alloc>& left, const hash_set <Key, Tr, Alloc>& right);template<class Key, class Tr, class Alloc> bool <B>operator==</B>( const hash_multiset <Key, Tr, Alloc>& left, const hash_multiset <Key, Tr, Alloc>& right);</PRE><P>The first template function overloads <CODE>operator==</CODE>to compare two objects of template class<A HREF="#hash_set"><CODE>hash_set</CODE></A>.The second template function overloads <CODE>operator==</CODE>to compare two objects of template class<A HREF="#hash_multiset"><CODE>hash_multiset</CODE></A>.Both functions return<CODE>left.<A HREF="#hash_multiset::size">size</A>() == right.size() &&<A HREF="algorith.html#equal">equal</A>(left.<A HREF="#hash_multiset::begin">begin</A>(), left.<A HREF="#hash_multiset::end">end</A>(), right.begin())</CODE>.</P><H2><A NAME="operator<"><CODE>operator<</CODE></A></H2><PRE>template<class Key, class Tr, class Alloc> bool <B>operator<</B>( const hash_set <Key, Tr, Alloc>& left, const hash_set <Key, Tr, Alloc>& right);template<class Key, class Tr, class Alloc> bool <B>operator<</B>( const hash_multiset <Key, Tr, Alloc>& left, const hash_multiset <Key, Tr, Alloc>& right);</PRE><P>The first template function overloads <CODE>operator<</CODE>to compare two objects of template class<A HREF="#hash_set"><CODE>hash_set</CODE></A>.The second template function overloads <CODE>operator<</CODE>to compare two objects of template class<A HREF="#hash_multiset"><CODE>hash_multiset</CODE></A>.Both functions return<CODE><A HREF="algorith.html#lexicographical_compare">lexicographical_compare</A>(left.<A HREF="#hash_multiset::begin">begin</A>(), left.<A HREF="#hash_multiset::end">end</A>(), right.begin(), right.end(),left.<A HREF="#hash_multiset::value_comp">value_comp</A>())</CODE>.</P><H2><A NAME="operator<="><CODE>operator<=</CODE></A></H2><PRE>template<class Key, class Tr, class Alloc> bool <B>operator<=</B>( const hash_set <Key, Tr, Alloc>& left, const hash_set <Key, Tr, Alloc>& right);template<class Key, class Tr, class Alloc> bool <B>operator<=</B>( const hash_multiset <Key, Tr, Alloc>& left, const hash_multiset <Key, Tr, 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 Tr, class Alloc> bool <B>operator></B>( const hash_set <Key, Tr, Alloc>& left, const hash_set <Key, Tr, Alloc>& right);template<class Key, class Tr, class Alloc> bool <B>operator></B>( const hash_multiset <Key, Tr, Alloc>& left, const hash_multiset <Key, Tr, 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 Tr, class Alloc> bool <B>operator>=</B>( const hash_set <Key, Tr, Alloc>& left, const hash_set <Key, Tr, Alloc>& right);template<class Key, class Tr, class Alloc> bool <B>operator>=</B>( const hash_multiset <Key, Tr, Alloc>& left, const hash_multiset <Key, Tr, Alloc>& right);</PRE><P>The template function returns <CODE>!(left < 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> © 1998-2002by P.J. Plauger. All rights reserved.</I></P><!--V4.01:1125--></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -