On 09 Jun 2015, at 11:37, Jens Alfke <[email protected]> wrote: > For backward compatibility in my APIs I’m doing stuff like this: > #if __has_feature(objc_generics) > typedef NSDictionary<NSString*, id> CBLJSONDict; > #else > typedef NSDictionary CBLJSONDict; > #endif > and then replacing “NSDictionary” with “CBLJSONDict” where appropriate.
Sounds like a job for a macro: #if __has_feature(objc_generics) #define GENERIC_COLLECTION(Name,Collection,argv…) typedef Collection<argv> Name #else #define GENERIC_COLLECTION(Name,Collection,argv…) typedef Collection Name #endif then all your code can just be like GENERIC_COLLECTION(CBLJSONDict,NSDictionary,NSString*,id); (typed in Mail, I might have gotten the syntax for variadic macros slightly wrong) Cheers, -- Uli Kusterer “The Witnesses of TeachText are everywhere...” http://zathras.de _______________________________________________ Do not post admin requests to the list. They will be ignored. Objc-language mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/objc-language/archive%40mail-archive.com This email sent to [email protected]
