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

📄 algorith.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 5 页
字号:
the range <CODE>[dest, dest + K)</CODE> must notoverlap the range <CODE>[first1, last1)</CODE>.If <CODE>dest</CODE> and <CODE>first2</CODE> designate regions of storage,the range <CODE>[dest, dest + K)</CODE> must notoverlap the range <CODE>[first2, last2)</CODE>.The function evaluates the ordering predicate <CODE>X &lt; Y</CODE> at most<CODE>K - 1</CODE> times.</P><P>The second template function behaves the same, except thatit replaces <CODE>operator&lt;(X, Y)</CODE> with<CODE>pred(X, Y)</CODE>.</P><H2><A NAME="min"><CODE>min</CODE></A></H2><PRE>template&lt;class Ty&gt;    const Ty&amp; <B>min</B>(const Ty&amp; left, const Ty&amp; right);template&lt;class Ty, class Pr&gt;    const Ty&amp; <B>min</B>(const Ty&amp; left, const Ty&amp; right, Pr pred);</PRE><P>The first template function returns <CODE>right</CODE> if<CODE>right &lt; left</CODE>. Otherwise it returns <CODE>left</CODE>.<CODE>Ty</CODE> need supply only a single-argument constructor and adestructor.</P><P>The second template function behaves the same, except thatit replaces <CODE>operator&lt;(X, Y)</CODE> with<CODE>pred(X, Y)</CODE>.</P><H2><A NAME="min_element"><CODE>min_element</CODE></A></H2><PRE>template&lt;class FwdIt&gt;    FwdIt <B>min_element</B>(FwdIt first, FwdIt last);template&lt;class FwdIt, class Pr&gt;    FwdIt <B>min_element</B>(FwdIt first, FwdIt last, Pr pred);</PRE><P>The first template function determines the lowest value of <CODE>N</CODE>in the range <CODE>[0, last - first)</CODE> such that,for each <CODE>M</CODE> in the range <CODE>[0, last - first)</CODE>the predicate <CODE>*(first + M) &lt; *(first + N)</CODE> is false.It then returns <CODE>first + N</CODE>.Thus, the function determines the lowest positionthat contains the smallest value in the sequence.</P><P>The function evaluates the ordering predicate<CODE>X &lt; Y</CODE> exactly<CODE>max((last - first) - 1, 0)</CODE> times.</P><P>The second template function behaves the same, except thatit replaces <CODE>operator&lt;(X, Y)</CODE> with<CODE>pred(X, Y)</CODE>.</P><H2><A NAME="mismatch"><CODE>mismatch</CODE></A></H2><PRE>template&lt;class InIt1, class InIt2&gt;    pair&lt;InIt1, InIt2&gt; <B>mismatch</B>(InIt1 first1, InIt1 last1,        InIt2 first2);template&lt;class InIt1, class InIt2, class Pr&gt;    pair&lt;InIt1, InIt2&gt; <B>mismatch</B>(InIt1 first1, InIt1 last1,        InIt2 first2, Pr pred);</PRE><P>The first template function determines the lowest value of<CODE>N</CODE> in the range <CODE>[0, last1 - first1)</CODE>for which the predicate<CODE>!(*(first1 + N) == *(first2 + N))</CODE> is true.Here, <CODE>operator==</CODE> must perform a<A HREF="lib_stl.html#pairwise comparison">pairwise comparison</A>between its operands.It then returns<CODE><A HREF="utility.html#pair">pair</A>(first1 + N, first2 + N)</CODE>.If no such value exists, N has the value <CODE>last1 - first1</CODE>.The function evaluates the predicate at most oncefor each <CODE>N</CODE>.</P><P>The second template function behaves the same, except thatthe predicate is <CODE>pred(*(first1 + N), *(first2 + N))</CODE>.</P><H2><A NAME="next_permutation"><CODE>next_permutation</CODE></A></H2><PRE>template&lt;class BidIt&gt;    bool <B>next_permutation</B>(BidIt first, BidIt last);template&lt;class BidIt, class Pr&gt;    bool <B>next_permutation</B>(BidIt first, BidIt last,        Pr pred);</PRE><P>The first template function determines a repeatingsequence of permutations, whose initial permutation occurs whenthe sequence designated by iteratorsin the range <CODE>[first, last)</CODE> is<A HREF="lib_stl.html#sequence ordering">ordered by</A> <CODE>operator&lt;</CODE>.(The elements are sorted in <I>ascending</I> order.)It then reorders the elements in the sequence, by evaluating<CODE><A HREF="#swap">swap</A>(X, Y)</CODE> for the elements<CODE>X</CODE> and <CODE>Y</CODE> zero or more times,to form the next permutation. The function returns true only if the resultingsequence is not the initial permutation. Otherwise, the resultantsequence is the one next larger lexicographically than the originalsequence. No two elements may have<A HREF="lib_stl.html#equivalent ordering">equivalent ordering</A>.</P><P>The function evaluates <CODE>swap(X, Y)</CODE>at most <CODE>(last - first) / 2</CODE>.</P><P>The second template function behaves the same, except thatit replaces <CODE>operator&lt;(X, Y)</CODE> with<CODE>pred(X, Y)</CODE>.</P><H2><A NAME="nth_element"><CODE>nth_element</CODE></A></H2><PRE>template&lt;class RanIt&gt;    void <B>nth_element</B>(RanIt first, RanIt nth, RanIt last);template&lt;class RanIt, class Pr&gt;    void <B>nth_element</B>(RanIt first, RanIt nth, RanIt last,        Pr pred);</PRE><P>The first template function reorders the sequencedesignated by iterators in therange <CODE>[first, last)</CODE> such that for each <CODE>N</CODE>in the range <CODE>[0, nth - first)</CODE> and for each <CODE>M</CODE>in the range <CODE>[nth - first, last - first)</CODE> the predicate<CODE>!(*(first + M) &lt; *(first + N))</CODE>is true. Moreover, for <CODE>N</CODE> equal to<CODE>nth - first</CODE> and for each <CODE>M</CODE>in the range <CODE>(nth - first, last - first)</CODE> the predicate<CODE>!(*(first + M) &lt; *(first + N))</CODE>is true. Thus, if <CODE>nth != last</CODE> the element <CODE>*nth</CODE>is in its proper position if elements of the entire sequencewere sorted in <I>ascending</I> order,<A HREF="lib_stl.html#sequence ordering">ordered by</A> <CODE>operator&lt;</CODE>.Any elements before this one belong before it in the sort sequence,and any elements after it belong after it.</P><P>The function evaluates the ordering predicate <CODE>X &lt; Y</CODE>a number of times proportional to<CODE>last - first</CODE>, on average.</P><P>The second template function behaves the same, except thatit replaces <CODE>operator&lt;(X, Y)</CODE> with<CODE>pred(X, Y)</CODE>.</P><H2><A NAME="partial_sort"><CODE>partial_sort</CODE></A></H2><PRE>template&lt;class RanIt&gt;    void <B>partial_sort</B>(RanIt first, RanIt mid,        RanIt last);template&lt;class RanIt, class Pr&gt;    void <B>partial_sort</B>(RanIt first, RanIt mid,        RanIt last, Pr pred);</PRE><P>The first template function reorders the sequencedesignated by iterators in therange <CODE>[first, last)</CODE> such that for each <CODE>N</CODE>in the range <CODE>[0, mid - first)</CODE> and for each <CODE>M</CODE>in the range <CODE>(N, last - first)</CODE> the predicate<CODE>!(*(first + M) &lt; *(first + N))</CODE>is true. Thus, the smallest <CODE>mid - first</CODE>elements of the entire sequence are sorted in <I>ascending</I> order,<A HREF="lib_stl.html#sequence ordering">ordered by</A> <CODE>operator&lt;</CODE>.The order of the remaining elements is otherwise unspecified.</P><P>The function evaluatesthe ordering predicate <CODE>X &lt; Y</CODE>a number of times proportional to at most<CODE>ceil((last - first) * log(mid - first))</CODE>.</P><P>The second template function behaves the same, except thatit replaces <CODE>operator&lt;(X, Y)</CODE> with<CODE>pred(X, Y)</CODE>.</P><H2><A NAME="partial_sort_copy"><CODE>partial_sort_copy</CODE></A></H2><PRE>template&lt;class InIt, class RanIt&gt;    RanIt <B>partial_sort_copy</B>(InIt first1, InIt last1,        RanIt first2, RanIt last2);template&lt;class InIt, class RanIt, class Pr&gt;    RanIt <B>partial_sort_copy</B>(InIt first1, InIt last1,        RanIt first2, RanIt last2, Pr pred);</PRE><P>The first template function determines <CODE>K</CODE>,the number of elements to copy as the smaller of<CODE>last1 - first1</CODE> and <CODE>last2 - first2</CODE>. It thencopies and reorders <CODE>K</CODE> elements of the sequencedesignated by iterators in therange <CODE>[first1, last1)</CODE> such thatthe <CODE>K</CODE> elements copied to <CODE>first2</CODE> are<A HREF="lib_stl.html#sequence ordering">ordered by</A> <CODE>operator&lt;</CODE>.Moreover, for each <CODE>N</CODE>in the range <CODE>[0, K)</CODE> and for each <CODE>M</CODE>in the range <CODE>(0, last1 - first1)</CODE> correspondingto an uncopied element, the predicate<CODE>!(*(first2 + M) &lt; *(first1 + N))</CODE>is true. Thus, the smallest <CODE>K</CODE>elements of the entire sequence designated by iteratorsin the range <CODE>[first1, last1)</CODE>are copied and sorted in <I>ascending</I> order to the range<CODE>[first2, first2 + K)</CODE>.</P><P>The function evaluatesthe ordering predicate <CODE>X &lt; Y</CODE>a number of times proportional to at most<CODE>ceil((last - first) * log(K))</CODE>.</P><P>The second template function behaves the same, except thatit replaces <CODE>operator&lt;(X, Y)</CODE> with<CODE>pred(X, Y)</CODE>.</P><H2><A NAME="partition"><CODE>partition</CODE></A></H2><PRE>template&lt;class BidIt, class Pr&gt;    BidIt <B>partition</B>(BidIt first, BidIt last, Pr pred);</PRE><P>The template function reorders the sequence designated by iterators in therange <CODE>[first, last)</CODE> and determines the value<CODE>K</CODE> such that for each <CODE>N</CODE> in the range<CODE>[0, K)</CODE> the predicate <CODE>pred(*(first + N))</CODE>is true, and for each <CODE>N</CODE> in the range<CODE>[K, last - first)</CODE> the predicate <CODE>pred(*(first + N))</CODE>is false. The function then returns <CODE>first + K</CODE>.</P><P>The predicate must not alter its operand.The function evaluates <CODE>pred(*(first + N))</CODE> exactly<CODE>last - first</CODE> times, and swaps at most<CODE>(last - first) / 2</CODE> pairs of elements.</P><H2><A NAME="pop_heap"><CODE>pop_heap</CODE></A></H2><PRE>template&lt;class RanIt&gt;    void <B>pop_heap</B>(RanIt first, RanIt last);template&lt;class RanIt, class Pr&gt;    void <B>pop_heap</B>(RanIt first, RanIt last, Pr pred);</PRE><P>The first template function reorders the sequencedesignated by iterators in therange <CODE>[first, last)</CODE> to form a new heap,<A HREF="lib_stl.html#heap ordering">ordered by</A> <CODE>operator&lt;</CODE> anddesignated by iterators in the range<CODE>[first, last - 1)</CODE>, leaving the originalelement at <CODE>*first</CODE> subsequently at <CODE>*(last - 1)</CODE>.The original sequence must designate an existing heap,also ordered by <CODE>operator&lt;</CODE>. Thus, <CODE>first !=last</CODE> must be true and <CODE>*(last - 1)</CODE> is theelement to remove from (pop off) the heap.</P><P>The function evaluates the ordering predicate<CODE>X &lt; Y</CODE> at most<CODE>ceil(2 * log(last - first))</CODE> times.</P><P>The second template function behaves the same, except thatit replaces <CODE>operator&lt;(X, Y)</CODE> with<CODE>pred(X, Y)</CODE>.</P><H2><A NAME="prev_permutation"><CODE>prev_permutation</CODE></A></H2><PRE>template&lt;class BidIt&gt;    bool <B>prev_permutation</B>(BidIt first, BidIt last);template&lt;class BidIt, class Pr&gt;    bool <B>prev_permutation</B>(BidIt first, BidIt last,        Pr pred);</PRE><P>The first template function determines a repeatingsequence of permutations, whose initial permutation occurs whenthe sequence designated by iteratorsin the range <CODE>[first, last)</CODE> is the <I>reverse</I> of one<A HREF="lib_stl.html#sequence ordering">ordered by</A> <CODE>operator&lt;</CODE>.(The elements are sorted in <I>descending</I> order.)It then reorders the elements in the sequence, by evaluating<CODE><A HREF="#swap">swap</A>(X, Y)</CODE> for the elements<CODE>X</CODE> and <CODE>Y</CODE> zero or more times,to form the previous permutation.The function returns true only if the resultingsequence is not the initial permutation. Otherwise, the resultantsequence is the one next smaller lexicographically than the originalsequence. No two elements may have<A HREF="lib_stl.html#equivalent ordering">equivalent ordering</A>.</P><P>The function evaluates <CODE>swap(X, Y)</CODE>at most <CODE>(last - first) / 2</CODE>.</P><P>The second template function behaves the same, except thatit replaces <CODE>operator&lt;(X, Y)</CODE> with<CODE>pred(X, Y)</CODE>.</P><H2><A NAME="push_heap"><CODE>push_heap</CODE></A></H2><PRE>template&lt;class RanIt&gt;    void <B>push_heap</B>(RanIt first, RanIt last);template&lt;class RanIt, class Pr&gt;    void <B>push_heap</B>(RanIt first, RanIt last, Pr pred);</PRE><P>The first template function reorders the sequencedesignated by iterators in therange <CODE>[first, last)</CODE> to form a new heap<A HREF="lib_stl.html#heap ordering">ordered by</A> <CODE>operator&lt;</CODE>.Iterators in the range

⌨️ 快捷键说明

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