Whats the best way to test if an array is completely empty then have something happen? e.g. if you have an array of enemies and you want to check if they're all dead then move on to the next level?
Whats the best way to test if an array is completely empty then have something happen? e.g. if you have an array of enemies and you want to check if they're all dead then move on to the next level?
Sorry, but i'm a Code::Blocks man now.
If you were only using a vector, you can test its size. Otherwise you'll have to (1) loop and count or (2) keep track as you add/delete.
Arrays don't have a concept of empty; vectors do but not arrays.
Arrays always hold something at each valid index even if it is say a zero value or a NULL pointer or a default constructed object.
You'd need to show code.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"