Getting index of the element in a for loop with an indexed_view
C++ 25 Mar 2019 831Use the `for` loop to get the element's index when iterating over indexed_view and index-based array. Use the range-based `for` without duplicating `num_treads` by using `jss::indexed_view` for obtaining index with range-based `for` loop.
Get the full working source code from linked github project and start using it.
"One crucial difference between using an index-based for loop and a range-based for loop is that the former allows you to use the index for something other than just identifying the element, whereas th..."
More info
#2nd
in TOP Native articles
Level
Junior
Author
Just Software Solutions
For further author's articles please visit the author's website.
https://www.justsoftwaresolutions.co.uk/