Created
August 16, 2012 20:04
-
-
Save lilyball/3373169 to your computer and use it in GitHub Desktop.
objc_cast
This file contains hidden or 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
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