mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 23:44:01 +01:00
ircd::util: Add weak typedef util.
This commit is contained in:
parent
59982cff43
commit
a023048419
1 changed files with 9 additions and 0 deletions
|
@ -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) \
|
||||
|
|
Loading…
Reference in a new issue