Equivalent of C++ STL container “pair” in Objective-C?

后端 未结 5 800
无人及你
无人及你 2021-02-13 03:34

I\'m new to Objective-C, so please don\'t judge me too much. I was wondering: Is there an equivalent of the C++ STL pair container I can use in Objective-C?

I want to bu

5条回答
  •  -上瘾入骨i
    2021-02-13 04:10

    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.

提交回复
热议问题