12#include "comms/details/macro_common.h"
14#define COMMS_ALIAS_MEM_ACC(prefix_, m_) COMMS_CONCATENATE(prefix_, m_)()
16#define COMMS_ALIAS_MEM_ACC_1(prefix_, m_) COMMS_EXPAND(COMMS_ALIAS_MEM_ACC(prefix_, m_))
17#define COMMS_ALIAS_MEM_ACC_2(prefix_, m_, ...) \
18 COMMS_ALIAS_MEM_ACC(prefix_, m_) . COMMS_EXPAND(COMMS_ALIAS_MEM_ACC_1(field_, __VA_ARGS__))
19#define COMMS_ALIAS_MEM_ACC_3(prefix_, m_, ...) \
20 COMMS_ALIAS_MEM_ACC(prefix_, m_) . COMMS_EXPAND(COMMS_ALIAS_MEM_ACC_2(field_, __VA_ARGS__))
21#define COMMS_ALIAS_MEM_ACC_4(prefix_, m_, ...) \
22 COMMS_ALIAS_MEM_ACC(prefix_, m_) . COMMS_EXPAND(COMMS_ALIAS_MEM_ACC_3(field_, __VA_ARGS__))
23#define COMMS_ALIAS_MEM_ACC_5(prefix_, m_, ...) \
24 COMMS_ALIAS_MEM_ACC(prefix_, m_) . COMMS_EXPAND(COMMS_ALIAS_MEM_ACC_4(field_, __VA_ARGS__))
25#define COMMS_ALIAS_MEM_ACC_6(prefix_, m_, ...) \
26 COMMS_ALIAS_MEM_ACC(prefix_, m_) . COMMS_EXPAND(COMMS_ALIAS_MEM_ACC_5(field_, __VA_ARGS__))
27#define COMMS_ALIAS_MEM_ACC_7(prefix_, m_, ...) \
28 COMMS_ALIAS_MEM_ACC(prefix_, m_) . COMMS_EXPAND(COMMS_ALIAS_MEM_ACC_6(field_, __VA_ARGS__))
29#define COMMS_ALIAS_MEM_ACC_8(prefix_, m_, ...) \
30 COMMS_ALIAS_MEM_ACC(prefix_, m_) . COMMS_EXPAND(COMMS_ALIAS_MEM_ACC_7(field_, __VA_ARGS__))
32#define COMMS_ALIAS_ALL_MEM_ACC_(N, prefix_, ...) COMMS_EXPAND(COMMS_ALIAS_MEM_ACC_ ## N(prefix_, __VA_ARGS__))
33#define COMMS_ALIAS_ALL_MEM_ACC(N, prefix_, ...) COMMS_EXPAND(COMMS_ALIAS_ALL_MEM_ACC_(N, prefix_, __VA_ARGS__))
34#define COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, ...) \
35 COMMS_EXPAND(COMMS_ALIAS_ALL_MEM_ACC(COMMS_NUM_ARGS(__VA_ARGS__), prefix_, __VA_ARGS__))
40#define COMMS_DO_ALIAS(prefix_, f1_, ...) \
41 decltype(auto) COMMS_CONCATENATE(prefix_, f1_) () \
43 return COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__); \
45 decltype(auto) COMMS_CONCATENATE(prefix_, f1_) () const \
47 return COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__); \
50#define COMMS_DO_ALIAS_NOTEMPLATE(prefix_, f1_, ...) COMMS_EXPAND(COMMS_DO_ALIAS(prefix_, f1_, __VA_ARGS__))
54#ifndef COMMS_DO_ALIAS_RET_TYPE_PREFIX
55#define COMMS_DO_ALIAS_RET_TYPE_PREFIX
58#if defined(__GNUC__) && !defined(__clang__)
60#undef COMMS_DO_ALIAS_RET_TYPE_PREFIX
61#define COMMS_DO_ALIAS_RET_TYPE_PREFIX this->
65#define COMMS_DO_ALIAS(prefix_, f1_, ...) \
66 auto COMMS_CONCATENATE(prefix_, f1_) () -> decltype(COMMS_DO_ALIAS_RET_TYPE_PREFIX COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__)) \
68 return COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__); \
70 auto COMMS_CONCATENATE(prefix_, f1_) () const -> decltype(COMMS_DO_ALIAS_RET_TYPE_PREFIX COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__)) \
72 return COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__); \
75#define COMMS_DO_ALIAS_NOTEMPLATE(prefix_, f1_, ...) \
76 auto COMMS_CONCATENATE(prefix_, f1_) () -> decltype(COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__)) \
78 return COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__); \
80 auto COMMS_CONCATENATE(prefix_, f1_) () const -> decltype(COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__)) \
82 return COMMS_DO_ALIAS_ALL_MEM_ACC(prefix_, __VA_ARGS__); \
89#define COMMS_FIELD_ALIAS_TYPE(P_, m_) COMMS_CONCATENATE(P_, m_)
91#define COMMS_FIELD_ALIAS_TYPE_1(P_, m_) COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE(P_, m_))
92#define COMMS_FIELD_ALIAS_TYPE_2(P_, m_, ...) \
93 COMMS_FIELD_ALIAS_TYPE(P_, m_) :: COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_1(Field_, __VA_ARGS__))
94#define COMMS_FIELD_ALIAS_TYPE_3(P_, m_, ...) \
95 COMMS_FIELD_ALIAS_TYPE(P_, m_) :: COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_2(Field_, __VA_ARGS__))
96#define COMMS_FIELD_ALIAS_TYPE_4(P_, m_, ...) \
97 COMMS_FIELD_ALIAS_TYPE(P_, m_) :: COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_3(Field_, __VA_ARGS__))
98#define COMMS_FIELD_ALIAS_TYPE_5(P_, m_, ...) \
99 COMMS_FIELD_ALIAS_TYPE(P_, m_) :: COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_4(Field_, __VA_ARGS__))
100#define COMMS_FIELD_ALIAS_TYPE_6(P_, m_, ...) \
101 COMMS_FIELD_ALIAS_TYPE(P_, m_) :: COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_5(Field_, __VA_ARGS__))
102#define COMMS_FIELD_ALIAS_TYPE_7(P_, m_, ...) \
103 COMMS_FIELD_ALIAS_TYPE(P_, m_) :: COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_6(Field_, __VA_ARGS__))
104#define COMMS_FIELD_ALIAS_TYPE_8(P_, m_, ...) \
105 COMMS_FIELD_ALIAS_TYPE(P_, m_) :: COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_7(Field_, __VA_ARGS__))
107#define COMMS_ALIAS_ALL_TYPES_(N, P_, ...) COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_ ## N(P_, __VA_ARGS__))
108#define COMMS_ALIAS_ALL_TYPES(N, P_, ...) COMMS_EXPAND(COMMS_ALIAS_ALL_TYPES_(N, P_, __VA_ARGS__))
109#define COMMS_DO_ALIAS_ALL_TYPES(P_, ...) \
110 COMMS_EXPAND(COMMS_ALIAS_ALL_TYPES(COMMS_NUM_ARGS(__VA_ARGS__), P_, __VA_ARGS__))
112#define COMMS_FIELD_ALIAS_TYPE_PREFIX_1
113#define COMMS_FIELD_ALIAS_TYPE_PREFIX_2 typename
114#define COMMS_FIELD_ALIAS_TYPE_PREFIX_3 typename
115#define COMMS_FIELD_ALIAS_TYPE_PREFIX_4 typename
116#define COMMS_FIELD_ALIAS_TYPE_PREFIX_5 typename
117#define COMMS_FIELD_ALIAS_TYPE_PREFIX_6 typename
118#define COMMS_FIELD_ALIAS_TYPE_PREFIX_7 typename
119#define COMMS_FIELD_ALIAS_TYPE_PREFIX_8 typename
121#define COMMS_FIELD_ALIAS_TYPE_PREFIX_(N) COMMS_FIELD_ALIAS_TYPE_PREFIX_ ## N
122#define COMMS_FIELD_ALIAS_TYPE_PREFIX(N) COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_PREFIX_(N))
124#define COMMS_DO_ALIAS_TYPEDEF(P_, n_, ...) \
125 using COMMS_CONCATENATE(P_, n_) = \
126 COMMS_EXPAND(COMMS_FIELD_ALIAS_TYPE_PREFIX(COMMS_NUM_ARGS(__VA_ARGS__))) COMMS_EXPAND(COMMS_DO_ALIAS_ALL_TYPES(P_, __VA_ARGS__));
Contains various compiler related definitions.