Member limit
opened this issue · comments
Deleted user commented
There appears to be a limit of 20 members on trait definitions.
Is there any way to increase this number?
Loki Astari commented
The simplest way is to break your class into sub classes.
class X {
std::string name; // 1
int age; // 2
int sex; // 3
int etc // 4
.....
std::string street1; // 18
std::string street2; // 19
std::string city; // 20
std::string state; // 21
std::string zip; // 22
std::string country; // 23
};
// Could be simplified like:
class X {
Person person; // 1
int etc; // 2
.....
Address address; // 16
};
If you want to change ThorsSerializer to support more fields then have a look in src/Serialize/Traits.h
You will need to add 21 and up for two macros.
// You need to define REP_OF_ It should be easy to see the pattern
#define REP_OF_20(Act, TC, P1, P2, ...) EXPAND(Act, TC, P1 ,P2), REP_OF_19(Act, TC, P1, __VA_ARGS__)
// You need to define ALT_REP_OF_ again the pattern should be obvious.
#define ALT_REP_OF_20(Act, E, P, S) P ALT_EXPAND(Act, E, 20), ALT_REP_OF_19(Act, E, , S)