Hi there
I'm having trouble with an iterator, I have used them very often so I'm not sure why i'm getting the error
heres my code
the compiler says;Code:void food::draw(Canvas &canvas) { for (Position foodpositions_[5]::iterator i = foodpositions_[0]; i != foodpositions_[5]; ++i) { canvas.blit(foodImage_,0,0,20,20, i->foodpositions_[].x_, i->foodpositions_[].y_); } }
Line 81 error: expected initializer before ‘::’ token
line 81 error: ‘i’ was not declared in this scope
line 83 error: expected primary-expression before ‘]’ token
line 83 error: expected primary-expression before ‘]’ token
the idea behind this code is that it will loop through an array for 5 elements and then blit the contents of each element to the screen.
Thanks in advance for any help given
ES



LinkBack URL
About LinkBacks



