Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to slice vector in c++

  vector<int> values = {35, 28, 34, 23};
  vector<int> res;
  // slice vector `values` from index 1 to the end
  // and assgin the result to `res`
  res.assign(values.begin() + 1, values.end());
  // equivalent
  vector<int> res1(values.begin() + 1, values.end());

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #slice #vector
ADD COMMENT
Topic
Name
6+6 =