配置生成逻辑优化
This commit is contained in:
@@ -498,16 +498,14 @@ void output_field(const T& field, Psc::JSON& ret, const char* name) {
|
||||
return ret; \
|
||||
}
|
||||
#define PSC_FROM_JSON \
|
||||
void from_base_json(const Psc::JSON* that_json, bool not_exist_use_default_value) { \
|
||||
void from_base_json(const Psc::JSON* that_json) { \
|
||||
using T = std::remove_cv_t<std::remove_pointer_t<decltype(this)>>; \
|
||||
boost::pfr::for_each_field( \
|
||||
*this, [&, names = boost::pfr::names_as_array<T>(), i = std::size_t{}](auto& field) mutable { \
|
||||
auto name = names[i++].data(); \
|
||||
std::error_code ec; \
|
||||
auto t = Psc::assign_field_ec(field, that_json, name, ec); \
|
||||
if (!not_exist_use_default_value) { \
|
||||
Psc::check_json_assign_field(t, ec, that_json, name); \
|
||||
} \
|
||||
Psc::check_json_assign_field(t, ec, that_json, name); \
|
||||
}); \
|
||||
}
|
||||
#define PSC_USE_JSON \
|
||||
|
||||
Reference in New Issue
Block a user