#include <boost/range/combine.hpp>
for (const auto& pair : boost::combine(arr, arr2)) {
cout << get<0>(pair) << endl;
}
Update: well, if you want to do this without promotion, you can implement a higher order function for it.
template <class T, unsigned long FirstLen, unsigned long SecondLen, class Pred>
typename std::enable_if<FirstLen == SecondLen, void>::type loop_two(T (&first)[FirstLen], T (&second)[SecondLen], Pred pred) {
for (unsigned long len = 0; len < FirstLen; ++len) {
pred(first[len], second[len]);
}
}
and use it as follows:
loop_two(arr, arr1, [] (unsigned a, unsigned b) {
cout << a << endl;
});