2 ms·
That sounds like a case where some sort of iterator class would be best (or, in C, an iterator "class" made of a struct with associated functions). It could hav
by quietbritishjim 4y ago
That sounds like a case where some sort of iterator class would be best (or, in C, an iterator "class" made of a struct with associated functions). It could have helper methods for .next_column() etc., and you'd just have one overall loop.
That might make the code more complicated, overall, but that's the trade off of structured programming - occasionally there's more complexity but it's so exceptionally rare that it's still worth it overall. (Then again ... perhaps it would make the code arguably simpler anyway.)