I made a little class to help me around some of my confusions regarding NSIndexSet. This class allows you to enumerate through an NSIndexSet using the Apple-suggested method :-
using simple enumerator-like messages.
Currently it doesn't support buffering (ie. if you have an NSIndexSet with one million entries, you'll end up with an internal array of one million entries), but it seems to work ok for what it is.
Please note that this is NOT rigorously tested or supported code, I just thought I'd share something that made my life a little easier (note also the extreme lack of code comments :-) ) but the code is relatively self explanatory (I hope!).
Download (4kb) :- NSIndexSetEnumerator.tgz
A basic code sample using a while statement :-
unsigned int current_index;and another, using a for loop :-
unsigned int current_index, loop_count;