Check out example codes for "how to create a vector from elements of an existing vector in cpp". It will help you in understanding the concepts better.

Code Example 1

// Initializing vector with values 
    vector<int> vect1{1, 2, 3, 4}; 
  
    // Declaring another vector 
    vector<int> vect2; 
  
    // Copying vector by assign function 
    vect2.assign(vect1.begin(), vect1.end());

Learn ReactJs, React Native from akashmittal.com