vendredi 26 janvier 2018

Creating an Array based on range from existing array

Say I have a std::array

std::array<int,8> foo = {1,2,3,4,5,6,7,8};

Now Is it possible to create a new array from an existing array using a range say from index to 2 till 5. So my new array will have items {3,4,5,6}. I am aware that I could accomplish this using the manual for loop copy mechanism but I wanted to know if there was a faster way of doing that

Aucun commentaire:

Enregistrer un commentaire