@@ -98,16 +98,18 @@ public: \
98
98
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N (varialble, val_name ) \
99
99
epee::serialization::selector<is_store>::serialize_t_val_as_blob (this_ref.varialble , stg, hparent_section, val_name);
100
100
101
- #define KV_SERIALIZE_VAL_POD_AS_BLOB_N (varialble, val_name ) \
102
- static_assert (std::is_pod<decltype (this_ref.varialble )>::value, " t_type must be a POD type." ); \
103
- KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N (varialble, val_name)
101
+ #define KV_SERIALIZE_VAL_POD_AS_BLOB_N (variable, val_name ) \
102
+ static_assert (std::is_trivially_copyable_v<decltype (this_ref.variable )>, " t_type must be a trivially copyable type." ); \
103
+ static_assert (std::is_standard_layout_v<decltype (this_ref.variable )>, " t_type must be a standard layout type." ); \
104
+ KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N (variable, val_name)
104
105
105
- #define KV_SERIALIZE_VAL_POD_AS_BLOB_OPT_N (varialble , val_name, default_value ) \
106
+ #define KV_SERIALIZE_VAL_POD_AS_BLOB_OPT_N (variable , val_name, default_value ) \
106
107
do { \
107
- static_assert (std::is_pod<decltype (this_ref.varialble )>::value, " t_type must be a POD type." ); \
108
- bool ret = KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N (varialble, val_name) \
108
+ static_assert (std::is_trivially_copyable_v<decltype (this_ref.variable )>, " t_type must be a trivially copyable type." ); \
109
+ static_assert (std::is_standard_layout_v<decltype (this_ref.variable )>, " t_type must be a standard layout type." ); \
110
+ bool ret = KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N (variable, val_name) \
109
111
if (!ret) \
110
- epee::serialize_default (this_ref.varialble , default_value); \
112
+ epee::serialize_default (this_ref.variable , default_value); \
111
113
} while (0 );
112
114
113
115
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N (varialble, val_name ) \
@@ -118,7 +120,7 @@ public: \
118
120
#define KV_SERIALIZE (varialble ) KV_SERIALIZE_N(varialble, #varialble)
119
121
#define KV_SERIALIZE_VAL_POD_AS_BLOB (varialble ) KV_SERIALIZE_VAL_POD_AS_BLOB_N(varialble, #varialble)
120
122
#define KV_SERIALIZE_VAL_POD_AS_BLOB_OPT (varialble, def ) KV_SERIALIZE_VAL_POD_AS_BLOB_OPT_N(varialble, #varialble, def)
121
- #define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE (varialble ) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) // skip is_pod compile time check
123
+ #define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE (varialble ) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) // skip is_trivially_copyable and is_standard_layout compile time check
122
124
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB (varialble ) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble)
123
125
#define KV_SERIALIZE_OPT (variable,default_value ) KV_SERIALIZE_OPT_N(variable, #variable, default_value)
124
126
0 commit comments