> refactor: iterate arrays via C++11 range-based for loops if idx is not needed
> refactor: init vectors via std::{begin,end} to avoid pointer arithmetic
> refactor: replace sizeof(a)/sizeof(a[0]) by std::size (C++17)
>
> Removes the macro ARRAYLEN and also substitutes all other uses of the same
> "sizeof(a)/sizeof(a[0])" pattern by std::size, available since C++17.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/20429 | [[https://github.com/bitcoin/bitcoin/pull/20429 | core#20429]]]] and one commit from [[https://github.com/bitcoin/bitcoin/pull/20245 | [[https://github.com/bitcoin/bitcoin/pull/20245 | core#20245]]]]
https://github.com/bitcoin/bitcoin/pull/20245/commits/fa3967efdb07f1d22372f4ee2e602ea1fad04a57
The commit from [[https://github.com/bitcoin/bitcoin/pull/20245 | [[https://github.com/bitcoin/bitcoin/pull/20245 | core#20245]]]] is doing the same thing as [[https://github.com/bitcoin/bitcoin/pull/20249 | [[https://github.com/bitcoin/bitcoin/pull/20249 | core#20249]]]], and is unrelated to the rest of its PR, so the partial backport will not cause any issue