Is there an integer vector struct in Cocoa or should I define my own?
I am keeping track of pairs of ints and NSUIntegers as array indexes and other things.
Is there something analogous to CGPoint that is already defined?
I'm doing graphics stuff on iPhone if it matters.
It's fairly easy to define your own struct to hold the data. You can use the CGPoint struct type (of which NSPoint is pretty much a #define alias) but you really need to define what you're using it for.
typedefstruct _pair {
int first,
int second
} pair;
You can then do:
pair foo; foo.first = 1; foo.second = 2;
Note this is only sensible if you have a fixed number of elements. If you're looking for a set of elements, you really want an array of ints.
There is NSIndexSet which can contain a bunch of indices and has some handy manipulation API.
For simple needs, you can just define a struct or, better yet, declare a class. I often declare a class with a set of @properties, @synthesizing all getters/setters, to encapsulate data. Easy, very little code, and it simplifies refactoring to add functionality later (i.e. if you decide your struct really wanted to be a class).