Skip to content

Commit c31b129

Browse files
committed
Refactor
1 parent d5f46be commit c31b129

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎include/iris/marshal/serialize.hpp‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct basic_save_fn
113113
{
114114
wr.begin_object();
115115
constexpr auto const& fields = adapted_class_traits<ClassT>::fields;
116-
alloy::for_each(fields, [&]<class T, auto GetMem, auto SetMem>(detail::field_definition<T, GetMem, SetMem> const& def) {
116+
alloy::for_each(fields, [&]<class FieldT, auto GetMem, auto SetMem>(detail::field_definition<FieldT, GetMem, SetMem> const& def) {
117117
if constexpr (adapted_proxy<decltype(def.name), format>) {
118118
wr.map_key(adapted_proxy_traits<decltype(def.name), format>::to_native_type(def.name));
119119
} else {
@@ -336,21 +336,17 @@ struct basic_load_fn
336336
}
337337
++index;
338338
});
339-
// unmatched map_key: ignored (policy)
339+
// unmatched `map_key` is ignored ...
340340
});
341341

342342
if (!ok) {
343343
throw load_error{"object: kind mismatch"};
344344
}
345345

346346
std::size_t index = 0;
347-
alloy::for_each(fields, [&]<class T, auto GetMem, auto SetMem>(detail::field_definition<T, GetMem, SetMem> const& def) {
347+
alloy::for_each(fields, [&](auto&& /* def */) {
348348
if (!seen.test(index)) {
349-
if constexpr (requires { def.default_value; }) {
350-
(klass.*SetMem)(def.default_value);
351-
} else {
352-
throw load_error{"object: missing required field"};
353-
}
349+
throw load_error{"object: missing required field"};
354350
}
355351
++index;
356352
});

0 commit comments

Comments
 (0)