From a0230484194eb650dfe63dfaeb1491da07a340d8 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 11 Sep 2016 15:14:41 -0700 Subject: [PATCH] ircd::util: Add weak typedef util. --- include/ircd/util.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/ircd/util.h b/include/ircd/util.h index 74c691509..1f8bdb473 100644 --- a/include/ircd/util.h +++ b/include/ircd/util.h @@ -42,6 +42,13 @@ inline namespace util { static constexpr NAME##_t NAME {}; +#define IRCD_WEAK_TYPEDEF(TYPE, NAME) \ +struct NAME \ +:TYPE \ +{ \ + using TYPE::TYPE; \ +}; + #define IRCD_STRONG_TYPEDEF(TYPE, NAME) \ struct NAME \ { \ @@ -51,6 +58,8 @@ struct NAME \ operator TYPE &() { return val; } \ }; +#define IRCD_WEAK_T(TYPE) \ + IRCD_WEAK_TYPEDEF(TYPE, IRCD_UNIQUE(weak_t)) // ex: using foo_t = IRCD_STRONG_T(int) #define IRCD_STRONG_T(TYPE) \