c++ - STL Algorithm for generating a vector -
I want to generate a vector using the STL algorithm to get the following
Const int n1 = 10; // This is a content offset = 3; // also std :: vector & lt; Int & gt; Chans (10); For (size_t i = 0; i & lt; chans.size (); i ++) {chance [i] = offset + n1 * i; }
Any suggestions?
14 with C ++:
std :: generated (Chans.begin (), chans.end (), [=, calculation = 0] () instability {return offset + n1 * calculation ++;});
Comments
Post a Comment