c++ - Matrix input and interpretation of the Input -


i have short question initialization don't understand. code: i'm looking pairs , vector "vector temp" saves places loop found pair. after temp filled values check pairs found. made 2 loops loop through vector. outer loop , inner loop j. temp stores j value pair found. question, code

    bool repeat = 1;     vector<double>::iterator rep_check;     rep_check = find(repeat_check.begin(), repeat_check.end(), d_in[i]);     if( rep_check == repeat_check.end() ) repeat = 0;     repeat_check.push_back(d_in[i]);     if(!repeat) out.push_back(temp);     else out.push_back(vector<int> (1,temp[0])); 

this part still in loop!!!!! dont understand last part: 'vector (1,temp[0])'. gets pushed output matrix (2x2 matrix), dont understand syntax here. how have interpret last part?

what doing here pushing vector<int> in container (i guess vector) named out. constructor call vector<int> (1,temp[0]) , says want construct vector<int> size 1 , vector elements (in case one) initialized value of temp[0].

the prototype of vector constructor looks like:

explicit vector (size_type n, const value_type& val = value_type(),                  const allocator_type& alloc = allocator_type()); 

and description is: fill constructor: constructs container n elements. each element copy of val.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -