Created
June 30, 2013 11:13
-
-
Save rabovik/5894790 to your computer and use it in GitHub Desktop.
Easily creating NSIndexSet & NSMutableIndexSet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef RSNSMutableIndexSetMake | |
#ifndef RSNSIndexSetMake | |
#define RSNSMutableIndexSetMake(INDEXES...) \ | |
({ \ | |
NSUInteger indexes[] = {INDEXES}; \ | |
NSUInteger count = sizeof(indexes)/sizeof(NSUInteger); \ | |
NSMutableIndexSet *mutableIndexSet = [NSMutableIndexSet indexSet]; \ | |
for (int i = 0; i < count; ++i){ \ | |
[mutableIndexSet addIndex:indexes[i]]; \ | |
} \ | |
mutableIndexSet; \ | |
}) | |
#define RSNSIndexSetMake(INDEXES...) \ | |
({ \ | |
[[NSIndexSet alloc] initWithIndexSet:RSNSMutableIndexSetMake(INDEXES)]; \ | |
}) | |
#endif | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment