Created
September 12, 2016 02:30
-
-
Save vinnybad/285204e1ee3a8c471b30e177265100de to your computer and use it in GitHub Desktop.
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
/** | |
* Lazy Getter | |
* | |
* Helps reduce silly errors when writing lazy getters. | |
*/ | |
#define ADD_LAZY_GETTER(type, name, initialValueBlock) \ | |
-(type)name \ | |
{ \ | |
if (!_##name) { \ | |
_##name = initialValueBlock(); \ | |
} \ | |
return _##name; \ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment