Equivalent of C++ STL container "pair<T1, T2>" in Objective-C?

You can write your own data structure object - for such a simple case, it would be pretty easy:

@interface Pair : NSObject 
{
    NSInteger integer;
    BOOL      boolean;
}
@property (nonatomic, assign) integer;
@property (nonatomic, assign) boolean;
@end

And a matching implementation, then you stick your Pair objects into the NSArray problem free.


You can use the STL in Objective-C++. All you need to do is change the extension of your .m file to .mm and I would also advise you use #import instead of #include. That way you can use your pair STL container.