19#ifndef CPPREALM_MACROS_HPP
20#define CPPREALM_MACROS_HPP
22#define FE_0(WHAT, cls)
23#define FE_1(WHAT, cls, X) WHAT(cls, X)
24#define FE_2(WHAT, cls, X, ...) WHAT(cls, X)FE_1(WHAT, cls, __VA_ARGS__)
25#define FE_3(WHAT, cls, X, ...) WHAT(cls, X)FE_2(WHAT, cls, __VA_ARGS__)
26#define FE_4(WHAT, cls, X, ...) WHAT(cls, X)FE_3(WHAT, cls, __VA_ARGS__)
27#define FE_5(WHAT, cls, X, ...) WHAT(cls, X)FE_4(WHAT, cls, __VA_ARGS__)
28#define FE_6(WHAT, cls, X, ...) WHAT(cls, X)FE_5(WHAT, cls, __VA_ARGS__)
29#define FE_7(WHAT, cls, X, ...) WHAT(cls, X)FE_6(WHAT, cls, __VA_ARGS__)
30#define FE_8(WHAT, cls, X, ...) WHAT(cls, X)FE_7(WHAT, cls, __VA_ARGS__)
31#define FE_9(WHAT, cls, X, ...) WHAT(cls, X)FE_8(WHAT, cls, __VA_ARGS__)
32#define FE_10(WHAT, cls, X, ...) WHAT(cls, X)FE_9(WHAT, cls, __VA_ARGS__)
33#define FE_11(WHAT, cls, X, ...) WHAT(cls, X)FE_10(WHAT, cls, __VA_ARGS__)
34#define FE_12(WHAT, cls, X, ...) WHAT(cls, X)FE_11(WHAT, cls, __VA_ARGS__)
35#define FE_13(WHAT, cls, X, ...) WHAT(cls, X)FE_12(WHAT, cls, __VA_ARGS__)
36#define FE_14(WHAT, cls, X, ...) WHAT(cls, X)FE_13(WHAT, cls, __VA_ARGS__)
37#define FE_15(WHAT, cls, X, ...) WHAT(cls, X)FE_14(WHAT, cls, __VA_ARGS__)
38#define FE_16(WHAT, cls, X, ...) WHAT(cls, X)FE_15(WHAT, cls, __VA_ARGS__)
39#define FE_17(WHAT, cls, X, ...) WHAT(cls, X)FE_16(WHAT, cls, __VA_ARGS__)
40#define FE_18(WHAT, cls, X, ...) WHAT(cls, X)FE_17(WHAT, cls, __VA_ARGS__)
41#define FE_19(WHAT, cls, X, ...) WHAT(cls, X)FE_18(WHAT, cls, __VA_ARGS__)
42#define FE_20(WHAT, cls, X, ...) WHAT(cls, X)FE_19(WHAT, cls, __VA_ARGS__)
43#define FE_21(WHAT, cls, X, ...) WHAT(cls, X)FE_20(WHAT, cls, __VA_ARGS__)
44#define FE_22(WHAT, cls, X, ...) WHAT(cls, X)FE_21(WHAT, cls, __VA_ARGS__)
45#define FE_23(WHAT, cls, X, ...) WHAT(cls, X)FE_22(WHAT, cls, __VA_ARGS__)
46#define FE_24(WHAT, cls, X, ...) WHAT(cls, X)FE_23(WHAT, cls, __VA_ARGS__)
47#define FE_25(WHAT, cls, X, ...) WHAT(cls, X)FE_24(WHAT, cls, __VA_ARGS__)
48#define FE_26(WHAT, cls, X, ...) WHAT(cls, X)FE_25(WHAT, cls, __VA_ARGS__)
49#define FE_27(WHAT, cls, X, ...) WHAT(cls, X)FE_26(WHAT, cls, __VA_ARGS__)
50#define FE_28(WHAT, cls, X, ...) WHAT(cls, X)FE_27(WHAT, cls, __VA_ARGS__)
51#define FE_29(WHAT, cls, X, ...) WHAT(cls, X)FE_28(WHAT, cls, __VA_ARGS__)
52#define FE_30(WHAT, cls, X, ...) WHAT(cls, X)FE_29(WHAT, cls, __VA_ARGS__)
53#define FE_31(WHAT, cls, X, ...) WHAT(cls, X)FE_30(WHAT, cls, __VA_ARGS__)
54#define FE_32(WHAT, cls, X, ...) WHAT(cls, X)FE_31(WHAT, cls, __VA_ARGS__)
55#define FE_33(WHAT, cls, X, ...) WHAT(cls, X)FE_32(WHAT, cls, __VA_ARGS__)
56#define FE_34(WHAT, cls, X, ...) WHAT(cls, X)FE_33(WHAT, cls, __VA_ARGS__)
57#define FE_35(WHAT, cls, X, ...) WHAT(cls, X)FE_34(WHAT, cls, __VA_ARGS__)
58#define FE_36(WHAT, cls, X, ...) WHAT(cls, X)FE_35(WHAT, cls, __VA_ARGS__)
59#define FE_37(WHAT, cls, X, ...) WHAT(cls, X)FE_36(WHAT, cls, __VA_ARGS__)
60#define FE_38(WHAT, cls, X, ...) WHAT(cls, X)FE_37(WHAT, cls, __VA_ARGS__)
61#define FE_39(WHAT, cls, X, ...) WHAT(cls, X)FE_38(WHAT, cls, __VA_ARGS__)
62#define FE_40(WHAT, cls, X, ...) WHAT(cls, X)FE_39(WHAT, cls, __VA_ARGS__)
63#define FE_41(WHAT, cls, X, ...) WHAT(cls, X)FE_40(WHAT, cls, __VA_ARGS__)
64#define FE_42(WHAT, cls, X, ...) WHAT(cls, X)FE_41(WHAT, cls, __VA_ARGS__)
65#define FE_43(WHAT, cls, X, ...) WHAT(cls, X)FE_42(WHAT, cls, __VA_ARGS__)
66#define FE_44(WHAT, cls, X, ...) WHAT(cls, X)FE_43(WHAT, cls, __VA_ARGS__)
67#define FE_45(WHAT, cls, X, ...) WHAT(cls, X)FE_44(WHAT, cls, __VA_ARGS__)
68#define FE_46(WHAT, cls, X, ...) WHAT(cls, X)FE_45(WHAT, cls, __VA_ARGS__)
69#define FE_47(WHAT, cls, X, ...) WHAT(cls, X)FE_46(WHAT, cls, __VA_ARGS__)
70#define FE_48(WHAT, cls, X, ...) WHAT(cls, X)FE_47(WHAT, cls, __VA_ARGS__)
71#define FE_49(WHAT, cls, X, ...) WHAT(cls, X)FE_48(WHAT, cls, __VA_ARGS__)
72#define FE_50(WHAT, cls, X, ...) WHAT(cls, X)FE_49(WHAT, cls, __VA_ARGS__)
73#define FE_51(WHAT, cls, X, ...) WHAT(cls, X)FE_50(WHAT, cls, __VA_ARGS__)
74#define FE_52(WHAT, cls, X, ...) WHAT(cls, X)FE_51(WHAT, cls, __VA_ARGS__)
75#define FE_53(WHAT, cls, X, ...) WHAT(cls, X)FE_52(WHAT, cls, __VA_ARGS__)
76#define FE_54(WHAT, cls, X, ...) WHAT(cls, X)FE_53(WHAT, cls, __VA_ARGS__)
77#define FE_55(WHAT, cls, X, ...) WHAT(cls, X)FE_54(WHAT, cls, __VA_ARGS__)
78#define FE_56(WHAT, cls, X, ...) WHAT(cls, X)FE_55(WHAT, cls, __VA_ARGS__)
79#define FE_57(WHAT, cls, X, ...) WHAT(cls, X)FE_56(WHAT, cls, __VA_ARGS__)
80#define FE_58(WHAT, cls, X, ...) WHAT(cls, X)FE_57(WHAT, cls, __VA_ARGS__)
81#define FE_59(WHAT, cls, X, ...) WHAT(cls, X)FE_58(WHAT, cls, __VA_ARGS__)
82#define FE_60(WHAT, cls, X, ...) WHAT(cls, X)FE_59(WHAT, cls, __VA_ARGS__)
83#define FE_61(WHAT, cls, X, ...) WHAT(cls, X)FE_60(WHAT, cls, __VA_ARGS__)
84#define FE_62(WHAT, cls, X, ...) WHAT(cls, X)FE_61(WHAT, cls, __VA_ARGS__)
85#define FE_63(WHAT, cls, X, ...) WHAT(cls, X)FE_62(WHAT, cls, __VA_ARGS__)
86#define FE_64(WHAT, cls, X, ...) WHAT(cls, X)FE_63(WHAT, cls, __VA_ARGS__)
87#define FE_65(WHAT, cls, X, ...) WHAT(cls, X)FE_64(WHAT, cls, __VA_ARGS__)
88#define FE_66(WHAT, cls, X, ...) WHAT(cls, X)FE_65(WHAT, cls, __VA_ARGS__)
89#define FE_67(WHAT, cls, X, ...) WHAT(cls, X)FE_66(WHAT, cls, __VA_ARGS__)
90#define FE_68(WHAT, cls, X, ...) WHAT(cls, X)FE_67(WHAT, cls, __VA_ARGS__)
91#define FE_69(WHAT, cls, X, ...) WHAT(cls, X)FE_68(WHAT, cls, __VA_ARGS__)
92#define FE_70(WHAT, cls, X, ...) WHAT(cls, X)FE_69(WHAT, cls, __VA_ARGS__)
93#define FE_71(WHAT, cls, X, ...) WHAT(cls, X)FE_70(WHAT, cls, __VA_ARGS__)
94#define FE_72(WHAT, cls, X, ...) WHAT(cls, X)FE_71(WHAT, cls, __VA_ARGS__)
95#define FE_73(WHAT, cls, X, ...) WHAT(cls, X)FE_72(WHAT, cls, __VA_ARGS__)
96#define FE_74(WHAT, cls, X, ...) WHAT(cls, X)FE_73(WHAT, cls, __VA_ARGS__)
97#define FE_75(WHAT, cls, X, ...) WHAT(cls, X)FE_74(WHAT, cls, __VA_ARGS__)
98#define FE_76(WHAT, cls, X, ...) WHAT(cls, X)FE_75(WHAT, cls, __VA_ARGS__)
99#define FE_77(WHAT, cls, X, ...) WHAT(cls, X)FE_76(WHAT, cls, __VA_ARGS__)
100#define FE_78(WHAT, cls, X, ...) WHAT(cls, X)FE_77(WHAT, cls, __VA_ARGS__)
101#define FE_79(WHAT, cls, X, ...) WHAT(cls, X)FE_78(WHAT, cls, __VA_ARGS__)
102#define FE_80(WHAT, cls, X, ...) WHAT(cls, X)FE_79(WHAT, cls, __VA_ARGS__)
103#define FE_81(WHAT, cls, X, ...) WHAT(cls, X)FE_80(WHAT, cls, __VA_ARGS__)
104#define FE_82(WHAT, cls, X, ...) WHAT(cls, X)FE_81(WHAT, cls, __VA_ARGS__)
105#define FE_83(WHAT, cls, X, ...) WHAT(cls, X)FE_82(WHAT, cls, __VA_ARGS__)
106#define FE_84(WHAT, cls, X, ...) WHAT(cls, X)FE_83(WHAT, cls, __VA_ARGS__)
107#define FE_85(WHAT, cls, X, ...) WHAT(cls, X)FE_84(WHAT, cls, __VA_ARGS__)
108#define FE_86(WHAT, cls, X, ...) WHAT(cls, X)FE_85(WHAT, cls, __VA_ARGS__)
109#define FE_87(WHAT, cls, X, ...) WHAT(cls, X)FE_86(WHAT, cls, __VA_ARGS__)
110#define FE_88(WHAT, cls, X, ...) WHAT(cls, X)FE_87(WHAT, cls, __VA_ARGS__)
111#define FE_89(WHAT, cls, X, ...) WHAT(cls, X)FE_88(WHAT, cls, __VA_ARGS__)
112#define FE_90(WHAT, cls, X, ...) WHAT(cls, X)FE_89(WHAT, cls, __VA_ARGS__)
113#define FE_91(WHAT, cls, X, ...) WHAT(cls, X)FE_90(WHAT, cls, __VA_ARGS__)
114#define FE_92(WHAT, cls, X, ...) WHAT(cls, X)FE_91(WHAT, cls, __VA_ARGS__)
115#define FE_93(WHAT, cls, X, ...) WHAT(cls, X)FE_92(WHAT, cls, __VA_ARGS__)
116#define FE_94(WHAT, cls, X, ...) WHAT(cls, X)FE_93(WHAT, cls, __VA_ARGS__)
117#define FE_95(WHAT, cls, X, ...) WHAT(cls, X)FE_94(WHAT, cls, __VA_ARGS__)
118#define FE_96(WHAT, cls, X, ...) WHAT(cls, X)FE_95(WHAT, cls, __VA_ARGS__)
119#define FE_97(WHAT, cls, X, ...) WHAT(cls, X)FE_96(WHAT, cls, __VA_ARGS__)
120#define FE_98(WHAT, cls, X, ...) WHAT(cls, X)FE_97(WHAT, cls, __VA_ARGS__)
121#define FE_99(WHAT, cls, X, ...) WHAT(cls, X)FE_98(WHAT, cls, __VA_ARGS__)
122#define FE_100(WHAT, cls, X, ...) WHAT(cls, X) FE_99(WHAT, cls, __VA_ARGS__)
123#define FE_101(WHAT, cls, X, ...) WHAT(cls, X) FE_100(WHAT, cls, __VA_ARGS__)
124#define FE_102(WHAT, cls, X, ...) WHAT(cls, X) FE_101(WHAT, cls, __VA_ARGS__)
125#define FE_103(WHAT, cls, X, ...) WHAT(cls, X) FE_102(WHAT, cls, __VA_ARGS__)
126#define FE_104(WHAT, cls, X, ...) WHAT(cls, X) FE_103(WHAT, cls, __VA_ARGS__)
127#define FE_105(WHAT, cls, X, ...) WHAT(cls, X) FE_104(WHAT, cls, __VA_ARGS__)
128#define FE_106(WHAT, cls, X, ...) WHAT(cls, X) FE_105(WHAT, cls, __VA_ARGS__)
129#define FE_107(WHAT, cls, X, ...) WHAT(cls, X) FE_106(WHAT, cls, __VA_ARGS__)
130#define FE_108(WHAT, cls, X, ...) WHAT(cls, X) FE_107(WHAT, cls, __VA_ARGS__)
131#define FE_109(WHAT, cls, X, ...) WHAT(cls, X) FE_108(WHAT, cls, __VA_ARGS__)
132#define FE_110(WHAT, cls, X, ...) WHAT(cls, X) FE_109(WHAT, cls, __VA_ARGS__)
133#define FE_111(WHAT, cls, X, ...) WHAT(cls, X) FE_110(WHAT, cls, __VA_ARGS__)
134#define FE_112(WHAT, cls, X, ...) WHAT(cls, X) FE_111(WHAT, cls, __VA_ARGS__)
135#define FE_113(WHAT, cls, X, ...) WHAT(cls, X) FE_112(WHAT, cls, __VA_ARGS__)
136#define FE_114(WHAT, cls, X, ...) WHAT(cls, X) FE_113(WHAT, cls, __VA_ARGS__)
137#define FE_115(WHAT, cls, X, ...) WHAT(cls, X) FE_114(WHAT, cls, __VA_ARGS__)
138#define FE_116(WHAT, cls, X, ...) WHAT(cls, X) FE_115(WHAT, cls, __VA_ARGS__)
139#define FE_117(WHAT, cls, X, ...) WHAT(cls, X) FE_116(WHAT, cls, __VA_ARGS__)
140#define FE_118(WHAT, cls, X, ...) WHAT(cls, X) FE_117(WHAT, cls, __VA_ARGS__)
141#define FE_119(WHAT, cls, X, ...) WHAT(cls, X) FE_118(WHAT, cls, __VA_ARGS__)
142#define FE_120(WHAT, cls, X, ...) WHAT(cls, X) FE_119(WHAT, cls, __VA_ARGS__)
143#define FE_121(WHAT, cls, X, ...) WHAT(cls, X) FE_120(WHAT, cls, __VA_ARGS__)
144#define FE_122(WHAT, cls, X, ...) WHAT(cls, X) FE_121(WHAT, cls, __VA_ARGS__)
145#define FE_123(WHAT, cls, X, ...) WHAT(cls, X) FE_122(WHAT, cls, __VA_ARGS__)
146#define FE_124(WHAT, cls, X, ...) WHAT(cls, X) FE_123(WHAT, cls, __VA_ARGS__)
147#define FE_125(WHAT, cls, X, ...) WHAT(cls, X) FE_124(WHAT, cls, __VA_ARGS__)
148#define FE_126(WHAT, cls, X, ...) WHAT(cls, X) FE_125(WHAT, cls, __VA_ARGS__)
149#define FE_127(WHAT, cls, X, ...) WHAT(cls, X) FE_126(WHAT, cls, __VA_ARGS__)
150#define FE_128(WHAT, cls, X, ...) WHAT(cls, X) FE_127(WHAT, cls, __VA_ARGS__)
151#define FE_129(WHAT, cls, X, ...) WHAT(cls, X) FE_128(WHAT, cls, __VA_ARGS__)
152#define FE_130(WHAT, cls, X, ...) WHAT(cls, X) FE_129(WHAT, cls, __VA_ARGS__)
153#define FE_131(WHAT, cls, X, ...) WHAT(cls, X) FE_130(WHAT, cls, __VA_ARGS__)
154#define FE_132(WHAT, cls, X, ...) WHAT(cls, X) FE_131(WHAT, cls, __VA_ARGS__)
155#define FE_133(WHAT, cls, X, ...) WHAT(cls, X) FE_132(WHAT, cls, __VA_ARGS__)
156#define FE_134(WHAT, cls, X, ...) WHAT(cls, X) FE_133(WHAT, cls, __VA_ARGS__)
157#define FE_135(WHAT, cls, X, ...) WHAT(cls, X) FE_134(WHAT, cls, __VA_ARGS__)
158#define FE_136(WHAT, cls, X, ...) WHAT(cls, X) FE_135(WHAT, cls, __VA_ARGS__)
159#define FE_137(WHAT, cls, X, ...) WHAT(cls, X) FE_136(WHAT, cls, __VA_ARGS__)
160#define FE_138(WHAT, cls, X, ...) WHAT(cls, X) FE_137(WHAT, cls, __VA_ARGS__)
161#define FE_139(WHAT, cls, X, ...) WHAT(cls, X) FE_138(WHAT, cls, __VA_ARGS__)
162#define FE_140(WHAT, cls, X, ...) WHAT(cls, X) FE_139(WHAT, cls, __VA_ARGS__)
163#define FE_141(WHAT, cls, X, ...) WHAT(cls, X) FE_140(WHAT, cls, __VA_ARGS__)
164#define FE_142(WHAT, cls, X, ...) WHAT(cls, X) FE_141(WHAT, cls, __VA_ARGS__)
165#define FE_143(WHAT, cls, X, ...) WHAT(cls, X) FE_142(WHAT, cls, __VA_ARGS__)
166#define FE_144(WHAT, cls, X, ...) WHAT(cls, X) FE_143(WHAT, cls, __VA_ARGS__)
167#define FE_145(WHAT, cls, X, ...) WHAT(cls, X) FE_144(WHAT, cls, __VA_ARGS__)
168#define FE_146(WHAT, cls, X, ...) WHAT(cls, X) FE_145(WHAT, cls, __VA_ARGS__)
169#define FE_147(WHAT, cls, X, ...) WHAT(cls, X) FE_146(WHAT, cls, __VA_ARGS__)
170#define FE_148(WHAT, cls, X, ...) WHAT(cls, X) FE_147(WHAT, cls, __VA_ARGS__)
171#define FE_149(WHAT, cls, X, ...) WHAT(cls, X) FE_148(WHAT, cls, __VA_ARGS__)
172#define FE_150(WHAT, cls, X, ...) WHAT(cls, X) FE_149(WHAT, cls, __VA_ARGS__)
173#define FE_151(WHAT, cls, X, ...) WHAT(cls, X) FE_150(WHAT, cls, __VA_ARGS__)
174#define FE_152(WHAT, cls, X, ...) WHAT(cls, X) FE_151(WHAT, cls, __VA_ARGS__)
175#define FE_153(WHAT, cls, X, ...) WHAT(cls, X) FE_152(WHAT, cls, __VA_ARGS__)
176#define FE_154(WHAT, cls, X, ...) WHAT(cls, X) FE_153(WHAT, cls, __VA_ARGS__)
177#define FE_155(WHAT, cls, X, ...) WHAT(cls, X) FE_154(WHAT, cls, __VA_ARGS__)
178#define FE_156(WHAT, cls, X, ...) WHAT(cls, X) FE_155(WHAT, cls, __VA_ARGS__)
179#define FE_157(WHAT, cls, X, ...) WHAT(cls, X) FE_156(WHAT, cls, __VA_ARGS__)
180#define FE_158(WHAT, cls, X, ...) WHAT(cls, X) FE_157(WHAT, cls, __VA_ARGS__)
181#define FE_159(WHAT, cls, X, ...) WHAT(cls, X) FE_158(WHAT, cls, __VA_ARGS__)
182#define FE_160(WHAT, cls, X, ...) WHAT(cls, X) FE_159(WHAT, cls, __VA_ARGS__)
183#define FE_161(WHAT, cls, X, ...) WHAT(cls, X) FE_160(WHAT, cls, __VA_ARGS__)
184#define FE_162(WHAT, cls, X, ...) WHAT(cls, X) FE_161(WHAT, cls, __VA_ARGS__)
185#define FE_163(WHAT, cls, X, ...) WHAT(cls, X) FE_162(WHAT, cls, __VA_ARGS__)
186#define FE_164(WHAT, cls, X, ...) WHAT(cls, X) FE_163(WHAT, cls, __VA_ARGS__)
187#define FE_165(WHAT, cls, X, ...) WHAT(cls, X) FE_164(WHAT, cls, __VA_ARGS__)
188#define FE_166(WHAT, cls, X, ...) WHAT(cls, X) FE_165(WHAT, cls, __VA_ARGS__)
189#define FE_167(WHAT, cls, X, ...) WHAT(cls, X) FE_166(WHAT, cls, __VA_ARGS__)
190#define FE_168(WHAT, cls, X, ...) WHAT(cls, X) FE_167(WHAT, cls, __VA_ARGS__)
191#define FE_169(WHAT, cls, X, ...) WHAT(cls, X) FE_168(WHAT, cls, __VA_ARGS__)
192#define FE_170(WHAT, cls, X, ...) WHAT(cls, X) FE_169(WHAT, cls, __VA_ARGS__)
193#define FE_171(WHAT, cls, X, ...) WHAT(cls, X) FE_170(WHAT, cls, __VA_ARGS__)
194#define FE_172(WHAT, cls, X, ...) WHAT(cls, X) FE_171(WHAT, cls, __VA_ARGS__)
195#define FE_173(WHAT, cls, X, ...) WHAT(cls, X) FE_172(WHAT, cls, __VA_ARGS__)
196#define FE_174(WHAT, cls, X, ...) WHAT(cls, X) FE_173(WHAT, cls, __VA_ARGS__)
197#define FE_175(WHAT, cls, X, ...) WHAT(cls, X) FE_174(WHAT, cls, __VA_ARGS__)
198#define FE_176(WHAT, cls, X, ...) WHAT(cls, X) FE_175(WHAT, cls, __VA_ARGS__)
199#define FE_177(WHAT, cls, X, ...) WHAT(cls, X) FE_176(WHAT, cls, __VA_ARGS__)
200#define FE_178(WHAT, cls, X, ...) WHAT(cls, X) FE_177(WHAT, cls, __VA_ARGS__)
201#define FE_179(WHAT, cls, X, ...) WHAT(cls, X) FE_178(WHAT, cls, __VA_ARGS__)
202#define FE_180(WHAT, cls, X, ...) WHAT(cls, X) FE_179(WHAT, cls, __VA_ARGS__)
203#define FE_181(WHAT, cls, X, ...) WHAT(cls, X) FE_180(WHAT, cls, __VA_ARGS__)
204#define FE_182(WHAT, cls, X, ...) WHAT(cls, X) FE_181(WHAT, cls, __VA_ARGS__)
205#define FE_183(WHAT, cls, X, ...) WHAT(cls, X) FE_182(WHAT, cls, __VA_ARGS__)
206#define FE_184(WHAT, cls, X, ...) WHAT(cls, X) FE_183(WHAT, cls, __VA_ARGS__)
207#define FE_185(WHAT, cls, X, ...) WHAT(cls, X) FE_184(WHAT, cls, __VA_ARGS__)
208#define FE_186(WHAT, cls, X, ...) WHAT(cls, X) FE_185(WHAT, cls, __VA_ARGS__)
209#define FE_187(WHAT, cls, X, ...) WHAT(cls, X) FE_186(WHAT, cls, __VA_ARGS__)
210#define FE_188(WHAT, cls, X, ...) WHAT(cls, X) FE_187(WHAT, cls, __VA_ARGS__)
211#define FE_189(WHAT, cls, X, ...) WHAT(cls, X) FE_188(WHAT, cls, __VA_ARGS__)
212#define FE_190(WHAT, cls, X, ...) WHAT(cls, X) FE_189(WHAT, cls, __VA_ARGS__)
213#define FE_191(WHAT, cls, X, ...) WHAT(cls, X) FE_190(WHAT, cls, __VA_ARGS__)
214#define FE_192(WHAT, cls, X, ...) WHAT(cls, X) FE_191(WHAT, cls, __VA_ARGS__)
215#define FE_193(WHAT, cls, X, ...) WHAT(cls, X) FE_192(WHAT, cls, __VA_ARGS__)
216#define FE_194(WHAT, cls, X, ...) WHAT(cls, X) FE_193(WHAT, cls, __VA_ARGS__)
217#define FE_195(WHAT, cls, X, ...) WHAT(cls, X) FE_194(WHAT, cls, __VA_ARGS__)
218#define FE_196(WHAT, cls, X, ...) WHAT(cls, X) FE_195(WHAT, cls, __VA_ARGS__)
219#define FE_197(WHAT, cls, X, ...) WHAT(cls, X) FE_196(WHAT, cls, __VA_ARGS__)
220#define FE_198(WHAT, cls, X, ...) WHAT(cls, X) FE_197(WHAT, cls, __VA_ARGS__)
221#define FE_199(WHAT, cls, X, ...) WHAT(cls, X) FE_198(WHAT, cls, __VA_ARGS__)
223#define GET_MACRO(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, \
224 _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26,\
225 _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40,\
226 _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54,\
227 _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68,\
228 _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82,\
229 _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, \
230 _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, \
231 _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, \
232 _122, _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133, \
233 _134, _135, _136, _137, _138, _139, _140, _141, _142, _143, _144, _145, \
234 _146, _147, _148, _149, _150, _151, _152, _153, _154, _155, _156, _157, \
235 _158, _159, _160, _161, _162, _163, _164, _165, _166, _167, _168, _169, \
236 _170, _171, _172, _173, _174, _175, _176, _177, _178, _179, _180, _181, \
237 _182, _183, _184, _185, _186, _187, _188, _189, _190, _191, _192, _193, \
238 _194, _195, _196, _197, _198, _199, NAME, ...) NAME \
240#define FOR_EACH(action, cls, ...) \
241 GET_MACRO(_0, __VA_ARGS__, \
242 FE_199, FE_198, FE_197, FE_196, FE_195, FE_194, FE_193, FE_192, FE_191, FE_190, \
243 FE_189, FE_188, FE_187, FE_186, FE_185, FE_184, FE_183, FE_182, FE_181, FE_180, \
244 FE_179, FE_178, FE_177, FE_176, FE_175, FE_174, FE_173, FE_172, FE_171, FE_170, \
245 FE_169, FE_168, FE_167, FE_166, FE_165, FE_164, FE_163, FE_162, FE_161, FE_160, \
246 FE_159, FE_158, FE_157, FE_156, FE_155, FE_154, FE_153, FE_152, FE_151, FE_150, \
247 FE_149, FE_148, FE_147, FE_146, FE_145, FE_144, FE_143, FE_142, FE_141, FE_140, \
248 FE_139, FE_138, FE_137, FE_136, FE_135, FE_134, FE_133, FE_132, FE_131, FE_130, \
249 FE_129, FE_128, FE_127, FE_126, FE_125, FE_124, FE_123, FE_122, FE_121, FE_120, \
250 FE_119, FE_118, FE_117, FE_116, FE_115, FE_114, FE_113, FE_112, FE_111, FE_110, \
251 FE_109, FE_108, FE_107, FE_106, FE_105, FE_104, FE_103, FE_102, FE_101, FE_100, \
252 FE_99, FE_98, FE_97, FE_96, FE_95, FE_94, FE_93, FE_92, FE_91, FE_90, \
253 FE_89, FE_88, FE_87, FE_86, FE_85, FE_84, FE_83, FE_82, FE_81, FE_80, \
254 FE_79, FE_78, FE_77, FE_76, FE_75, FE_74, FE_73, FE_72, FE_71, FE_70, \
255 FE_69, FE_68, FE_67, FE_66, FE_65, FE_64, FE_63, FE_62, FE_61, FE_60, \
256 FE_59, FE_58, FE_57, FE_56, FE_55, FE_54, FE_53, FE_52, FE_51, FE_50, \
257 FE_49, FE_48, FE_47, FE_46, FE_45, FE_44, FE_43, FE_42, FE_41, FE_40, \
258 FE_39, FE_38, FE_37, FE_36, FE_35, FE_34, FE_33, FE_32, FE_31, FE_30, \
259 FE_29, FE_28, FE_27, FE_26, FE_25, FE_24, FE_23, FE_22, FE_21, FE_20, \
260 FE_19, FE_18, FE_17, FE_16, FE_15, FE_14, FE_13, FE_12, FE_11, FE_10, \
261 FE_9, FE_8, FE_7, FE_6, FE_5, FE_4, FE_3, FE_2, FE_1, FE_0)(action, cls, __VA_ARGS__)
264 template<
typename T,
typename =
void>
268#define DECLARE_PERSISTED(cls, property) managed<decltype(cls::property)> property;
269#define DECLARE_PROPERTY(cls, p) realm::property<&cls::p>(#p),
270#define DECLARE_MANAGED_PROPERTY(cls, p) &realm::managed<cls>::p,
271#define DECLARE_MANAGED_PROPERTY_NAME(cls, p) #p,
272#define DECLARE_COND_UNMANAGED_TO_MANAGED(cls, p) if constexpr (std::is_same_v<decltype(ptr), decltype(&cls::p)>) { return &managed<cls>::p; }
276#include <cpprealm/internal/bridge/col_key.hpp>
277#include <cpprealm/internal/bridge/obj.hpp>
278#include <cpprealm/internal/bridge/object.hpp>
279#include <cpprealm/internal/bridge/property.hpp>
280#include <cpprealm/internal/bridge/query.hpp>
281#include <cpprealm/internal/bridge/realm.hpp>
291 m_realm = other.m_realm;
293 m_rbool_query = other.m_rbool_query;
297 m_realm = other.m_realm;
299 m_rbool_query = other.m_rbool_query;
303 m_obj = std::move(other.m_obj);
304 m_realm = std::move(other.m_realm);
305 m_key = std::move(other.m_key);
306 m_rbool_query = std::move(other.m_rbool_query);
309 m_obj = std::move(other.m_obj);
310 m_realm = std::move(other.m_realm);
311 m_key = std::move(other.m_key);
312 m_rbool_query = std::move(other.m_rbool_query);
318 m_rbool_query =
nullptr;
322 static constexpr bool is_object =
false;
327 rbool* m_rbool_query =
nullptr;
333 this->m_realm = realm;
341 this->m_realm = realm;
347 if constexpr (std::is_same_v<T, std::nullopt_t>) {
348 m_obj->set_null(m_key);
350 m_obj->template set<typename internal::type_info::type_info<T, void>::internal_type>(m_key, v);
357 const std::string_view& col_name,
359 this->m_realm = realm;
360 this->m_key = table.get_column_key(col_name);
361 this->m_rbool_query = query_builder;
365 template<
typename T,
typename>
369#define __cpprealm_build_query(op, name, type) \
370rbool managed<type>::operator op(const type& rhs) const noexcept { \
371 if (this->m_rbool_query) { \
372 return this->m_rbool_query->name(m_key, rhs); \
374 return serialize(detach()) op serialize(rhs); \
377#define __cpprealm_build_optional_query(op, name, type) \
378rbool managed<std::optional<type>>::operator op(const std::optional<type>& rhs) const noexcept { \
379 if (this->m_rbool_query) { \
380 return this->m_rbool_query->name(m_key, rhs); \
382 return serialize(detach()) op serialize(rhs); \
385#define REALM_SCHEMA(cls, ...) \
386 DECLARE_REALM_SCHEMA(cls, false, false, ObjectType::TopLevel, __VA_ARGS__) \
388#define REALM_EMBEDDED_SCHEMA(cls, ...) \
389 DECLARE_REALM_SCHEMA(cls, true, false, ObjectType::Embedded, __VA_ARGS__)
391#define REALM_ASYMMETRIC_SCHEMA(cls, ...) \
392 DECLARE_REALM_SCHEMA(cls, false, true, ObjectType::Asymmetric, __VA_ARGS__)
394#define DECLARE_REALM_SCHEMA(cls, is_embedded_object, is_asymmetric_object, obj_type, ...) \
395 template <> struct managed<cls> { \
396 managed() = default; \
397 static constexpr ObjectType object_type = obj_type; \
398 FOR_EACH(DECLARE_PERSISTED, cls, __VA_ARGS__) \
399 static constexpr auto schema = realm::schema(#cls, object_type, std::tuple{ FOR_EACH(DECLARE_PROPERTY, cls, __VA_ARGS__) } ); \
400 static constexpr auto managed_pointers() { \
401 return std::tuple{FOR_EACH(DECLARE_MANAGED_PROPERTY, cls, __VA_ARGS__)}; \
403 template <typename PtrType> static constexpr auto unmanaged_to_managed_pointer(PtrType ptr) { \
404 FOR_EACH(DECLARE_COND_UNMANAGED_TO_MANAGED, cls, __VA_ARGS__); \
406 static constexpr auto managed_pointers_names() { \
407 constexpr auto managed_pointers_names = std::array<std::string_view, std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value>{FOR_EACH(DECLARE_MANAGED_PROPERTY_NAME, cls, __VA_ARGS__)}; \
408 return internal::array_to_tuple(managed_pointers_names); \
411 static constexpr bool is_object = true; \
412 explicit managed(const internal::bridge::obj& obj, \
413 internal::bridge::realm realm) \
414 : m_obj(std::move(obj)) \
415 , m_realm(std::move(realm)) \
417 auto zipped = internal::zip_tuples(managed_pointers(), managed_pointers_names()); \
418 std::apply([&](auto& ...pair) { \
419 ((*this.*pair.first).assign(&m_obj, &m_realm, m_obj.get_table().get_column_key(pair.second)), ...); \
422 managed(const managed& other) { \
423 m_obj = other.m_obj; \
424 m_realm = other.m_realm; \
425 m_rbool_query = other.m_rbool_query; \
426 auto zipped = internal::zip_tuples(managed_pointers(), managed_pointers_names()); \
427 if (m_rbool_query) { \
428 auto schema = m_realm.schema().find(other.schema.name); \
429 auto group = m_realm.read_group(); \
430 auto table_ref = group.get_table(schema.table_key()); \
431 std::apply([&](auto& ...pair) { \
432 ((*this.*pair.first).prepare_for_query(&m_realm, table_ref, pair.second, m_rbool_query), ...); \
435 std::apply([&](auto& ...pair) { \
436 ((*this.*pair.first).assign(&m_obj, &m_realm, m_obj.get_table().get_column_key(pair.second)), ...); \
440 managed& operator=(const managed& other) { \
441 m_obj = other.m_obj; \
442 m_realm = other.m_realm; \
443 m_rbool_query = other.m_rbool_query; \
444 auto zipped = internal::zip_tuples(managed_pointers(), managed_pointers_names()); \
445 if (m_rbool_query) { \
446 auto schema = m_realm.schema().find(other.schema.name); \
447 auto group = m_realm.read_group(); \
448 auto table_ref = group.get_table(schema.table_key()); \
449 std::apply([&](auto& ...pair) { \
450 ((*this.*pair.first).prepare_for_query(&m_realm, table_ref, pair.second, m_rbool_query), ...); \
453 std::apply([&](auto& ...pair) { \
454 ((*this.*pair.first).assign(&m_obj, &m_realm, m_obj.get_table().get_column_key(pair.second)), ...); \
459 managed(managed&& other) { \
460 m_obj = std::move(other.m_obj); \
461 m_realm = std::move(other.m_realm); \
462 m_rbool_query = std::move(other.m_rbool_query); \
463 auto zipped = internal::zip_tuples(managed_pointers(), managed_pointers_names()); \
464 if (m_rbool_query) { \
465 auto schema = m_realm.schema().find(other.schema.name); \
466 auto group = m_realm.read_group(); \
467 auto table_ref = group.get_table(schema.table_key()); \
468 std::apply([&](auto& ...pair) { \
469 ((*this.*pair.first).prepare_for_query(&m_realm, table_ref, pair.second, m_rbool_query), ...); \
472 std::apply([&](auto& ...pair) { \
473 ((*this.*pair.first).assign(&m_obj, &m_realm, m_obj.get_table().get_column_key(pair.second)), ...); \
477 managed& operator=(managed&& other) { \
478 m_obj = std::move(other.m_obj); \
479 m_realm = std::move(other.m_realm); \
480 m_rbool_query = std::move(other.m_rbool_query); \
481 auto zipped = internal::zip_tuples(managed_pointers(), managed_pointers_names()); \
482 if (m_rbool_query) { \
483 auto schema = m_realm.schema().find(other.schema.name); \
484 auto group = m_realm.read_group(); \
485 auto table_ref = group.get_table(schema.table_key()); \
486 std::apply([&](auto& ...pair) { \
487 ((*this.*pair.first).prepare_for_query(&m_realm, table_ref, pair.second, m_rbool_query), ...); \
490 std::apply([&](auto& ...pair) { \
491 ((*this.*pair.first).assign(&m_obj, &m_realm, m_obj.get_table().get_column_key(pair.second)), ...); \
496 static managed prepare_for_query(const internal::bridge::realm& r, realm::rbool* q) { \
499 m.m_rbool_query = q; \
500 auto schema = m.m_realm.schema().find(m.schema.name); \
501 auto group = m.m_realm.read_group(); \
502 auto table_ref = group.get_table(schema.table_key()); \
503 auto zipped = internal::zip_tuples(managed_pointers(), managed_pointers_names()); \
504 std::apply([&m, &table_ref](auto& ...pair) { \
505 ((m.*pair.first).prepare_for_query(&m.m_realm, table_ref, pair.second, m.m_rbool_query), ...); \
509 cls detach() const { \
511 auto assign = [&v, this](auto& pair) { \
512 v.*(std::decay_t<decltype(pair.first)>::ptr) = ((*this).*(pair.second)).detach(); \
514 auto zipped = internal::zip_tuples(managed<cls>::schema.ps, managed<cls>::managed_pointers()); \
515 std::apply([&assign](auto& ...pair) { \
516 (assign(pair), ...); \
520 auto observe(std::function<void(realm::object_change<managed>&&)>&& fn) { \
521 auto m_object = std::make_shared<internal::bridge::object>(m_realm, m_obj); \
522 auto wrapper = realm::object_change_callback_wrapper<managed>{ \
523 std::move(fn), this, m_object}; \
524 return m_object->add_notification_callback( \
525 std::make_shared<realm::object_change_callback_wrapper<managed>>(wrapper)); \
527 bool is_invalidated() { \
528 return !m_obj.is_valid(); \
531 return m_realm.is_frozen(); \
533 managed<cls> freeze() { \
534 auto realm = m_realm.freeze(); \
535 return managed<cls>(realm.import_copy_of(m_obj), realm); \
537 managed<cls> thaw() { \
538 if (is_invalidated()) { \
539 throw std::runtime_error("Invalid objects cannot be thawed."); \
541 if (!is_frozen()) { \
544 auto thawed_realm = m_realm.thaw(); \
545 return managed<cls>(thawed_realm.import_copy_of(m_obj), thawed_realm); \
548 return db(m_realm); \
550 bool operator ==(const managed<cls>& other) const { \
551 if (m_rbool_query != nullptr) \
552 throw std::runtime_error("This comparison operator is not valid inside of `where`"); \
554 auto& b = other.m_obj; \
555 if (m_realm != other.m_realm) { \
558 return a.get_table() == b.get_table() \
559 && a.get_key() == b.get_key(); \
561 bool operator ==(const managed<cls*>& other) const { \
562 if (m_rbool_query != nullptr) \
563 throw std::runtime_error("This comparison operator is not valid inside of `where`"); \
565 auto& b = other.m_obj; \
566 if (m_realm != other->m_realm) { \
569 return a.get_table() == b->get_table() \
570 && a.get_key() == b->get_key(); \
572 bool operator !=(const managed<cls>& other) const { \
573 return !this->operator ==(other); \
575 bool operator !=(const managed<cls*>& other) const { \
576 return !this->operator ==(other); \
578 bool operator < (const managed<cls>& rhs) const { \
579 return m_obj.get_key() < rhs.m_obj.get_key(); \
581 void to_json(std::ostream& out) const noexcept { \
582 m_obj.to_json(out); \
585 internal::bridge::obj m_obj; \
586 internal::bridge::realm m_realm; \
587 rbool* m_rbool_query = nullptr; \
589 template <typename, typename> friend struct managed; \
590 template <typename, typename> friend struct box; \
591 template <typename> friend struct ::realm::thread_safe_reference; \
592 template <typename T> friend rbool* ::realm::internal::get_rbool(const T&); \
595 struct meta_schema_##cls { \
596 meta_schema_##cls() { \
597 auto s = managed<cls>::schema.to_core_schema(); \
598 auto it = std::find(std::begin(realm::db::schemas), std::end(realm::db::schemas), s); \
599 if (it == std::end(realm::db::schemas)) \
600 realm::db::schemas.push_back(s); \
603 static inline meta_schema_##cls _meta_schema_##cls{};
605namespace realm::internal {
611 rbool* get_rbool(
const T& o) {
612 return o.m_rbool_query;
Definition: col_key.hpp:28
Definition: macros.hpp:286