From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../manual/generalized_numeric_operations.html | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libstdc++-v3/doc/html/manual/generalized_numeric_operations.html (limited to 'libstdc++-v3/doc/html/manual/generalized_numeric_operations.html') diff --git a/libstdc++-v3/doc/html/manual/generalized_numeric_operations.html b/libstdc++-v3/doc/html/manual/generalized_numeric_operations.html new file mode 100644 index 000000000..043cbeb36 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/generalized_numeric_operations.html @@ -0,0 +1,32 @@ + + +Generalized Operations

+

There are four generalized functions in the <numeric> header + that follow the same conventions as those in <algorithm>. Each + of them is overloaded: one signature for common default operations, + and a second for fully general operations. Their names are + self-explanatory to anyone who works with numerics on a regular basis: +

Here is a simple example of the two forms of accumulate. +

+   int   ar[50];
+   int   someval = somefunction();
+
+   // ...initialize members of ar to something...
+
+   int  sum       = std::accumulate(ar,ar+50,0);
+   int  sum_stuff = std::accumulate(ar,ar+50,someval);
+   int  product   = std::accumulate(ar,ar+50,1,std::multiplies<int>());
+   

The first call adds all the members of the array, using zero as an + initial value for sum. The second does the same, but uses + someval as the starting value (thus, sum_stuff == sum + + someval). The final call uses the second of the two signatures, + and multiplies all the members of the array; here we must obviously + use 1 as a starting value instead of 0. +

The other three functions have similar dual-signature forms. +

-- cgit v1.2.3