Skip to content

Instantly share code, notes, and snippets.

@lilyball
Created August 16, 2012 20:04
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lilyball/3373169 to your computer and use it in GitHub Desktop.
Save lilyball/3373169 to your computer and use it in GitHub Desktop.
objc_cast
template<typename T> inline T* objc_cast(id from) {
if ([from isKindOfClass:[T class]]) {
return static_cast<T*>(from);
}
return nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment