From d600e844aa4736b52fe71c1b2a9fa785be5cfecc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 30 May 2018 16:25:46 -0700 Subject: [PATCH] Add CrapOrNull --- src/hb-private.hh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/hb-private.hh b/src/hb-private.hh index 4a8f795e4..e3ca2aee1 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -605,6 +605,17 @@ static inline Type& Crap (void) { } #define Crap(Type) Crap() +template +struct CrapOrNull { + static inline Type & get (void) { return Crap(Type); } +}; +template +struct CrapOrNull { + static inline Type const & get (void) { return Null(Type); } +}; +#define CrapOrNull(Type) CrapOrNull::get () + + /* arrays and maps */