stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r1230322 - /stdcxx/trunk/doc/stdlibref/bind1st.html
Date Wed, 11 Jan 2012 23:20:11 GMT
Author: faridz
Date: Wed Jan 11 23:20:11 2012
New Revision: 1230322

URL: http://svn.apache.org/viewvc?rev=1230322&view=rev
Log:
2012-01-12  Farid Zaripov  <faridz@apache.org>

	Merged r699389 from 4.2.x branch.

	2008-09-26  Martin Sebor  <sebor@roguewave.com>

	STDCXX-1017
	* doc/stdlibref/bind1st.html (Description): Corrected confusing
	text.
	Updated code snippet to use the standard three-argument count_if()
	algorithm instead of the obsolete four-argument extension.

Modified:
    stdcxx/trunk/doc/stdlibref/bind1st.html   (contents, props changed)

Modified: stdcxx/trunk/doc/stdlibref/bind1st.html
URL: http://svn.apache.org/viewvc/stdcxx/trunk/doc/stdlibref/bind1st.html?rev=1230322&r1=1230321&r2=1230322&view=diff
==============================================================================
--- stdcxx/trunk/doc/stdlibref/bind1st.html (original)
+++ stdcxx/trunk/doc/stdlibref/bind1st.html Wed Jan 11 23:20:11 2012
@@ -64,14 +64,13 @@ namespace std {
 <A NAME="sec4"><H3>Description</H3></A>
 <P>Because so many functions included in the C++ Standard Library take other functions
as arguments, the library includes classes that let you build new function objects out of
old ones. Both <SAMP><A HREF="bind1st.html">bind1st()</A></SAMP> and
<SAMP><A HREF="bind1st.html">bind2nd()</A></SAMP> are functions that
take as arguments a binary function object <SAMP>f</SAMP> and a value <SAMP>x,</SAMP>
and return, respectively, classes <B><I><A HREF="bind1st.html">binder1st</A></I></B>
and <B><I><A HREF="bind1st.html">binder2nd</A></I></B>.
The underlying function object must be a subclass of <B><I><A HREF="binary-function.html">binary_function</A></I></B>.</P>
 <P>Class <B><I><A HREF="bind1st.html">binder1st</A></I></B>
binds the value to the first argument of the binary function, and <B><I><A
HREF="bind1st.html">binder2nd</A></I></B> does the same thing for the
second argument of the function. The resulting classes can be used in place of a unary predicate
in other function calls.</P>
-<P>For example, you could use the <SAMP><A HREF="count.html">count_if()</A></SAMP>
algorithm to count all elements in a <B><I><A HREF="vector.html">vector</A></I></B>
that are less than or equal to 7, using the following:</P>
+<P>For example, you could use the <SAMP><A HREF="count.html">count_if()</A></SAMP>
algorithm to count all elements in a <B><I><A HREF="vector.html">vector</A></I></B>
that are less than 7, using the following:</P>
 
 <UL><PRE>
-vector&lt;int&gt; v;<br>int littleNums;<br>
-count_if(v.begin, v.end, bind1st(greater&lt;int&gt;(),7),
-         littleNums)
+std::vector&lt;int&gt; v (/* ... */);
+int littleNums = std::count_if (v.begin (), v.end (), std::bind1st (std::less&lt;int&gt;(),
7));
 </PRE></UL>
-<P>This function adds one to <SAMP>littleNums</SAMP> each time the element
is greater than&nbsp;7.</P>
+<P>The function counts the number of elements in the range [<SAMP>v.begin()</SAMP>,
<SAMP>v.end()</SAMP>) as denoted by the first two iterator arguments that satisfy
the predicate specified by the third argument and returns the result.</P>
 <A NAME="sec5"><H3>Interface</H3></A>
 
 <UL><PRE>namespace std {

Propchange: stdcxx/trunk/doc/stdlibref/bind1st.html
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Jan 11 23:20:11 2012
@@ -0,0 +1 @@
+/stdcxx/branches/4.2.x/doc/stdlibref/bind1st.html:699389,814395,814400-814401,814405,814409



Mime
View raw message