Last active
December 23, 2015 09:59
-
-
Save akuraru/6618829 to your computer and use it in GitHub Desktop.
Objective-Cでタプル
This file contains 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
#define tuple(_1, _2) [Tuple tupleWithFirst:_1 second:_2]; | |
@interface Tuple : NSObject | |
@property (readonly, nonatomic) id _1; | |
@property (readonly, nonatomic) id _2; | |
+ (id)tupleWithFirst:(id)_1 second:(id)_2; | |
- (id)initWithFirst:(id)_1 second:(id)_2; | |
@end | |
@implementation Tuple | |
+ (id)tupleWithFirst:(id)_1 second:(id)_2 { | |
return [[self alloc] initWithFirst:_1 second:_2]; | |
} | |
- (id)initWithFirst:(id)_1 second:(id)_2 { | |
self = [super init]; | |
if (self) { | |
__1 = _1; | |
__2 = _2; | |
} | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment