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

📄 algorith.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 5 页
字号:
It then returns <CODE>first1 + N</CODE>.If no such value exists, the function returns <CODE>last1</CODE>.It evaluates the predicate at most <CODE>(last2 - first2) *(last1 - first1 - (last2 - first2) + 1)</CODE> times.</P><P>The second template function behaves the same, except thatthe predicate is <CODE>pred(*(first1 + N + M), *(first2 + N + M))</CODE>.</P><H2><A NAME="find_first_of"><CODE>find_first_of</CODE></A></H2><PRE>template&lt;class FwdIt1, class FwdIt2&gt;    FwdIt1 <B>find_first_of</B>(FwdIt1 first1, FwdIt1 last1,        FwdIt2 first2, FwdIt2 last2);template&lt;class FwdIt1, class FwdIt2, class Pr&gt;    FwdIt1 <B>find_first_of</B>(FwdIt1 first1, FwdIt1 last1,        FwdIt2 first2, FwdIt2 last2, Pr pred);</PRE><P>The first template function determines the lowest value of<CODE>N</CODE> in the range <CODE>[0, last1 - first1)</CODE> such thatfor some <CODE>M</CODE> in the range <CODE>[0, last2 - first2)</CODE>,the predicate <CODE>*(first1 + N) == *(first2 + M)</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>first1 + N</CODE>.If no such value exists, the function returns <CODE>last1</CODE>.It evaluates the predicate at most<CODE>(last1 - first1) * (last2 - first2)</CODE> times.</P><P>The second template function behaves the same, except thatthe predicate is <CODE>pred(*(first1 + N), *(first2 + M))</CODE>.</P><H2><A NAME="find_if"><CODE>find_if</CODE></A></H2><PRE>template&lt;class InIt, class Pr&gt;    InIt <B>find_if</B>(InIt first, InIt last, Pr pred);</PRE><P>The template function determines the lowest value of <CODE>N</CODE>in the range <CODE>[0, last - first)</CODE> for which the predicate<CODE>pred(*(first + N))</CODE> is true.It then returns <CODE>first + N</CODE>.If no such value exists, the function returns <CODE>last</CODE>.It evaluates the predicate at most oncefor each <CODE>N</CODE>.</P><H2><A NAME="for_each"><CODE>for_each</CODE></A></H2><PRE>template&lt;class InIt, class Fn1&gt;    Fn1 <B>for_each</B>(InIt first, InIt last, Fn1 func);</PRE><P>The template function evaluates <CODE>func(*(first + N))</CODE> once foreach <CODE>N</CODE> in the range <CODE>[0, last - first)</CODE>.It then returns <CODE>func</CODE>.</P><H2><A NAME="generate"><CODE>generate</CODE></A></H2><PRE>template&lt;class FwdIt, class Fn0&gt;    void <B>generate</B>(FwdIt first, FwdIt last, Fn0 func);</PRE><P>The template function evaluates <CODE>*(first + N) = func()</CODE> once foreach <CODE>N</CODE> in the range <CODE>[0, last - first)</CODE>.</P><H2><A NAME="generate_n"><CODE>generate_n</CODE></A></H2><PRE>template&lt;class OutIt, class Pr, class Fn0&gt;    void <B>generate_n</B>(OutIt first, Diff count, Fn0 func);</PRE><P>The template function evaluates <CODE>*(first + N) = func()</CODE> once foreach <CODE>N</CODE> in the range <CODE>[0, count)</CODE>.</P><H2><A NAME="includes"><CODE>includes</CODE></A></H2><PRE>template&lt;class InIt1, class InIt2&gt;    bool <B>includes</B>(InIt1 first1, InIt1 last1,        InIt2 first2, InIt2 last2);template&lt;class InIt1, class InIt2, class Pr&gt;    bool <B>includes</B>(InIt1 first1, InIt1 last1,        InIt2 first2, InIt2 last2, Pr pred);</PRE><P>The first template function determines whethera value of <CODE>N</CODE> existsin the range <CODE>[0, last2 - first2)</CODE> such that,for each <CODE>M</CODE> in the range <CODE>[0, last1 - first1)</CODE>,<CODE>*(first1 + M)</CODE> and <CODE>*(first2 + N)</CODE> do not have<A HREF="lib_stl.html#equivalent ordering">equivalent ordering</A>,where the elements designated by iteratorsin the ranges <CODE>[first1, last1)</CODE>and <CODE>[first2, last2)</CODE> each form a sequence<A HREF="lib_stl.html#sequence ordering">ordered by</A> <CODE>operator&lt;</CODE>.If so, the function returns false.If no such value exists, it returns true.Thus, the function determines whether the ordered sequencedesignated by iterators in the range<CODE>[first2, last2)</CODE> all have equivalent ordering with someelement designated by iterators in the range<CODE>[first1, last1)</CODE>.</P><P>The function evaluates the predicate at most<CODE>2 * ((last1 - first1) + (last2 - first2)) - 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="inplace_merge"><CODE>inplace_merge</CODE></A></H2><PRE>template&lt;class BidIt&gt;    void <B>inplace_merge</B>(BidIt first, BidIt mid,        BidIt last);template&lt;class BidIt, class Pr&gt;    void <B>inplace_merge</B>(BidIt first, BidIt mid,        BidIt last, Pr pred);</PRE><P>The first template function reorders thesequences designated by iterators in the ranges <CODE>[first, mid)</CODE>and <CODE>[mid, last)</CODE>, each<A HREF="lib_stl.html#sequence ordering">ordered by</A> <CODE>operator&lt;</CODE>,to form a merged sequence of length <CODE>last - first</CODE>beginning at <CODE>first</CODE> also ordered by <CODE>operator&lt;</CODE>.The merge occurs without altering the relative order ofelements within either original sequence. Moreover, for any two elementsfrom different original sequences that have<A HREF="lib_stl.html#equivalent ordering">equivalent ordering</A>,the element from the ordered range <CODE>[first, mid)</CODE>precedes the other.</P><P>The function evaluates the ordering predicate<CODE>X &lt; Y</CODE> at most<CODE>ceil((last - first) * log(last - first))</CODE> times.(Given enough temporary storage, it can evaluate the predicate at most<CODE>(last - first) - 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="iter_swap"><CODE>iter_swap</CODE></A></H2><PRE>template&lt;class FwdIt1, class FwdIt2&gt;    void <B>iter_swap</B>(FwdIt1 left, FwdIt2 right);</PRE><P>The template function leaves the value originally stored in<CODE>*right</CODE> subsequently stored in <CODE>*left</CODE>,and the value originally stored in <CODE>*left</CODE>subsequently stored in <CODE>*right</CODE>.</P><H2><A NAME="lexicographical_compare"><CODE>lexicographical_compare</CODE></A></H2><PRE>template&lt;class InIt1, class InIt2&gt;    bool <B>lexicographical_compare</B>(InIt1 first1,        InIt1 last1, InIt2 first2, InIt2 last2);template&lt;class InIt1, class InIt2, class Pr&gt;    bool <B>lexicographical_compare</B>(InIt1 first1,        InIt1 last1, InIt2 first2, InIt2 last2, Pr pred);</PRE><P>The first template function determines <CODE>K</CODE>,the number of elements to compare as the smaller of<CODE>last1 - first1</CODE> and <CODE>last2 - first2</CODE>.It then determines the lowest value of <CODE>N</CODE>in the range <CODE>[0, K)</CODE> for which<CODE>*(first1 + N)</CODE> and <CODE>*(first2 + N)</CODE> do not have<A HREF="lib_stl.html#equivalent ordering">equivalent ordering</A>.If no such value exists, the function returns true only if<CODE>K &lt; (last2 - first2)</CODE>. Otherwise, it returnstrue only if <CODE>*(first1 + N) &lt; *(first2 + N)</CODE>.Thus, the function returns true only if the sequence designatedby iterators in the range <CODE>[first1, last1)</CODE> islexicographically less than the other sequence.</P><P>The function evaluates the ordering predicate<CODE>X &lt; Y</CODE> at most <CODE>2 * K</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="lower_bound"><CODE>lower_bound</CODE></A></H2><PRE>template&lt;class FwdIt, class Ty&gt;    FwdIt <B>lower_bound</B>(FwdIt first, FwdIt last,        const Ty&amp; val);template&lt;class FwdIt, class Ty, class Pr&gt;    FwdIt <B>lower_bound</B>(FwdIt first, FwdIt last,        const Ty&amp; val, Pr pred);</PRE><P>The first template function determines the highest 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, N)</CODE>the predicate <CODE>*(first + M) &lt; val</CODE> is true,where the elements designated by iteratorsin the range <CODE>[first, last)</CODE> form a sequence<A HREF="lib_stl.html#sequence ordering">ordered by</A> <CODE>operator&lt;</CODE>.It then returns <CODE>first + N</CODE>.Thus, the function determines the lowest positionbefore which <CODE>val</CODE> can be inserted in the sequenceand still preserve its ordering.</P><P>The function evaluates the ordering predicate <CODE>X &lt; Y</CODE> at most<CODE>ceil(log(last - first)) + 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="make_heap"><CODE>make_heap</CODE></A></H2><PRE>template&lt;class RanIt&gt;    void <B>make_heap</B>(RanIt first, RanIt last);template&lt;class RanIt, class Pr&gt;    void <B>make_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 heap<A HREF="lib_stl.html#heap ordering">ordered by</A> <CODE>operator&lt;</CODE>.</P><P>The function evaluates the ordering predicate<CODE>X &lt; Y</CODE> at most<CODE>3 * (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="max"><CODE>max</CODE></A></H2><PRE>template&lt;class Ty&gt;    const Ty&amp; <B>max</B>(const Ty&amp; left, const Ty&amp; right);template&lt;class Ty, class Pr&gt;    const Ty&amp; <B>max</B>(const Ty&amp; left, const Ty&amp; right, Pr pred);</PRE><P>The first template function returns <CODE>right</CODE> if<CODE>left &lt; right</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="max_element"><CODE>max_element</CODE></A></H2><PRE>template&lt;class FwdIt&gt;    FwdIt <B>max_element</B>(FwdIt first, FwdIt last);template&lt;class FwdIt, class Pr&gt;    FwdIt <B>max_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 + N) &lt; *(first + M)</CODE> is false.It then returns <CODE>first + N</CODE>.Thus, the function determines the lowest positionthat contains the largest 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="merge"><CODE>merge</CODE></A></H2><PRE>template&lt;class InIt1, class InIt2, class OutIt&gt;    OutIt <B>merge</B>(InIt1 first1, InIt1 last1,        InIt2 first2, InIt2 last2, OutIt dest);template&lt;class InIt1, class InIt2, class OutIt,    class Pr&gt;    OutIt <B>merge</B>(InIt1 first1, InIt1 last1,        InIt2 first2, InIt2 last2, OutIt dest, Pr pred);</PRE><P>The first template function determines <CODE>K</CODE>,the number of elements to copy as <CODE>(last1 - first1) +(last2 - first2)</CODE>. It then alternatelycopies two sequences, designated by iteratorsin the ranges <CODE>[first1, last1)</CODE>and <CODE>[first2, last2)</CODE> and each<A HREF="lib_stl.html#sequence ordering">ordered by</A> <CODE>operator&lt;</CODE>,to form a merged sequence of length <CODE>K</CODE> beginningat <CODE>dest</CODE>, also ordered by <CODE>operator&lt;</CODE>.The function then returns <CODE>dest + K</CODE>.</P><P>The merge occurs without altering the relative order ofelements within either sequence. Moreover, for any two elementsfrom different sequences that have<A HREF="lib_stl.html#equivalent ordering">equivalent ordering</A>,the element from the ordered range <CODE>[first1, last1)</CODE>precedes the other. Thus, the function merges two orderedsequences to form another ordered sequence.</P><P>If <CODE>dest</CODE> and <CODE>first1</CODE> designate regions of storage,

⌨️ 快捷键说明

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