Partially revert "Compile without foreach"
Because some people have sometimes issues I am doing a partial revert of the MR. Cases where the container was declared/passed in the method as const are kept as they are on master.
Big sorry for causing issues :/