Fill in vector with array by using pointer and offset : vector indexer « Vector « C++






Fill in vector with array by using pointer and offset

  
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main(int argc, char** argv)
{
  int elems[] = {5, 6, 9, 8, 8, 3};

  vector<int> myVector(elems, elems + 6); 

  return (0);
}
  
    
  








Related examples in the same category

1.Use indexer to update element in the vector
2.Use toupper function to convert all elements in a char vector to upper case
3.make the index of the maximum