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?
Printable View
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?
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.