Home > Back-end >  Accumulat () function
Accumulat () function

Time:10-05

Who help explain what the exact meaning of this code?
The accumulate () is not only three parameters? How to understand the place?

The accumulate (what exactly do v.begin (), v.e nd (), 1, multiplies ());

CodePudding user response:

http://blog.csdn.net/sprintwater/article/details/7392415
http://blog.csdn.net/zhuxianjianqi/article/details/7487866
There are four parameters of usage, but I don't know the meaning

CodePudding user response:

//the accumulate example 
#include //STD: : cout
#include //STD: : minus
#include //STD: : the accumulate

Int myfunction (int x, int y) {return x + 2 * y. }
Struct myclass {
Int operator () (int x, int y) {return x + 3 * y; }
} myobject;

Int main () {
Int init=100;
Int Numbers []={10, 30};

STD: : cout & lt; <"Using the default the accumulate:";
STD: : cout & lt; STD: : cout & lt; <'\ n';

STD: : cout & lt; <"Using the functional 's minus:";
STD: : cout & lt; ());
STD: : cout & lt; <'\ n';

STD: : cout & lt; <"Using the custom function:";
STD: : cout & lt; STD: : cout & lt; <'\ n';

STD: : cout & lt; <"Using the custom object:";
STD: : cout & lt; STD: : cout & lt; <'\ n';

return 0;
}

CodePudding user response:

The multiplication system at the fourth parameter is a function of the third parameter to each yuan multiplication of the container, then add the accumulation of all
  • Related