Is there a way to “bulk evaluate” the contents of an array in C++? For example, let int numbers[10]={23,42,12,42,53,10,0,0,0,0}. Is there a way to loop through each element in the array and check whether the element meets a specified condition?
In short, I’d like to be able to do something like:
if(every element in the array meets arbitrary condition)
do this
or
if(array element from m to array element n==something)
do this
For small arrays, I know I could use something like: if(numbers[0]==blabla) && if(numbers[n]==blabla), then do this, but obviously this is not a realistic solution when it comes to evaluating very large arrays.
” if(every element in the array meets arbitrary condition) do this ”
with STL:
” if(every element in the array meets arbitrary condition) do this ”
without STL
“if(array element from m to array element n==something) do this”
with STL
“if(array element from m to array element n==something) do this”
without STL