ulf.schroeter Posted July 23, 2012 Posted July 23, 2012 Problem There seems to be a bug with nested foreachkey language constructs. The following code Statistics map[]; foreachkey( string row; map ) { ... foreachkey( string column; map ) // ERROR { .... } } produces "UserArray::forEachKeyStep(): bad map iterator" error message. Workaround Usage of redundant map copy for inner foreachkey loop works Statistics map[]; Statistics map_copy[]; map_copy.copy( map ); foreachkey( string row; map ) { ... foreachkey( string column; map_copy ) // NO ERROR { .... } }
frustum Posted July 24, 2012 Posted July 24, 2012 It's not a bug, it's a feature. The iterator is stored inside the array because of performance reason.
ulf.schroeter Posted July 24, 2012 Author Posted July 24, 2012 ok, than some hint/warning within documentation an foreachkey would be helpful
Recommended Posts