Getting index of the element in a for loop with an indexed_view

Photo by Just Software Solutions

Use 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..."

Read more on the site

View Article

More info
#22nd in TOP Native articles
Level Junior

Author

Added by: Jack
Report article