<p>The infinite loop was my mistake. I was looking at your outer while loop but because you use exceptions instead of return values it indeed throws an exception, my bad :)</p>
<p>By replacing ref by const ref my program slowed down (looked over a period of 10_000 runs). Not considerably but noticeable. Compiled with -release -noboundscheck -O -inline. Anyone else experiencing the same?</p>
<p>Is copying a static arrays cheaper then recalculating the lovation of collumns and squares btw?</p>