This commit is contained in:
2026-09-07 19:01:44 +03:00
parent ed2a5cac45
commit ef798ddaf2
4 changed files with 64 additions and 62 deletions

View File

@@ -316,29 +316,24 @@ public:
static_assert(std::invocable<ST, v_t const&>, "Invalid setter argument type!");
}
using tp_t = std::tuple<UTs...>;
if constexpr (sizeof...(UTs)) {
using tp_t = std::tuple<UTs...>;
[&id, getter_cap = std::forward<GT>(getter), setter_cap = std::forward<ST>(setter),
this]<size_t... Is>(std::index_sequence<Is...>) mutable {
return std::apply(
[this](auto&&... args) { addAttr(std::forward<decltype(args)>(args)...); },
std::tuple_cat(
std::forward_as_tuple(id, std::forward<decltype(getter_cap)>(getter_cap),
std::forward<decltype(setter_cap)>(setter_cap)),
std::tuple_cat(std::forward_as_tuple(
decltype(_attrGetter)::template trivial_conv_from<v_t, std::tuple_element_t<Is, tp_t>>,
decltype(_attrGetter)::template trivial_conv_to<v_t, std::tuple_element_t<Is, tp_t>>)...)));
}(std::make_index_sequence<sizeof...(UTs)>{});
// [&id, setter_cap = std::forward<ST>(setter), this]<size_t... Is>(std::index_sequence<Is...>) mutable {
// return std::apply(
// [this](auto&&... args) { addAttr(std::forward<decltype(args)>(args)...); },
// std::tuple_cat(
// std::forward_as_tuple(id, std::forward<decltype(setter_cap)>(setter_cap)),
// std::tuple_cat(std::forward_as_tuple(
// decltype(_attrSetter)::template trivial_conv_from<v_t, std::tuple_element_t<Is, tp_t>>,
// decltype(_attrSetter)::template trivial_conv_to<v_t, std::tuple_element_t<Is, tp_t>>)...)));
// }(std::make_index_sequence<sizeof...(UTs)>{});
[&id, getter_cap = std::forward<GT>(getter), setter_cap = std::forward<ST>(setter),
this]<size_t... Is>(std::index_sequence<Is...>) mutable {
return std::apply(
[this](auto&&... args) { addAttr(std::forward<decltype(args)>(args)...); },
std::tuple_cat(
std::forward_as_tuple(id, std::forward<decltype(getter_cap)>(getter_cap),
std::forward<decltype(setter_cap)>(setter_cap)),
std::tuple_cat(std::forward_as_tuple(
decltype(_attrGetter)::template trivial_conv_from<v_t, std::tuple_element_t<Is, tp_t>>,
decltype(_attrGetter)::template trivial_conv_to<v_t, std::tuple_element_t<Is, tp_t>>)...)));
}(std::make_index_sequence<sizeof...(UTs)>{});
} else {
_attrGetter.push(id, std::forward<GT>(getter));
_attrSetter.push(id, std::forward<ST>(setter));
}
}
//
@@ -386,7 +381,8 @@ public:
using from_fn_t = std::decay_t<std::tuple_element_t<I, TpT>>;
using to_fn_t = std::decay_t<std::tuple_element_t<I + 1, TpT>>;
using u_t = adclib_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>;
// using u_t = adclib_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>;
using u_t = std::invoke_result_t<from_fn_t>::value_type;
// static_assert(requires(v_t v, u_t u) { u = v; }, "Invalid deduced user type!");
@@ -407,7 +403,9 @@ public:
using from_fn_t = std::decay_t<std::tuple_element_t<I, TpT>>;
using to_fn_t = std::decay_t<std::tuple_element_t<I + 1, TpT>>;
using u_t = adclib_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>;
// using u_t = adclib_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>;
using u_t = std::invoke_result_t<from_fn_t>::value_type;
// static_assert(requires(v_t v, u_t u) { v = u; }, "Invalid deduced user type!");
@@ -429,7 +427,9 @@ public:
using from_fn_t = std::decay_t<std::tuple_element_t<I, TpT>>;
using to_fn_t = std::decay_t<std::tuple_element_t<I + 1, TpT>>;
using u_t = adclib_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>;
// using u_t = adclib_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>;
using u_t = std::invoke_result_t<from_fn_t>::value_type;
// static_assert(requires(v_t v, u_t u) { v = u; }, "Invalid deduced user type!");
@@ -446,17 +446,17 @@ public:
};
};
std::apply(
[this](auto&&... args) { _attrGetter.push(std::forward<decltype(args)>(args)...); },
std::tuple_cat(std::forward_as_tuple(id, std::forward<decltype(getter_cap)>(getter_cap)),
std::tuple_cat(std::forward_as_tuple(gt_cnv_from_func.template operator()<Is>(tp),
gt_cnv_to_func.template operator()<Is>(tp))...)));
std::apply([this](auto&&... args) { _attrGetter.push(std::forward<decltype(args)>(args)...); },
std::tuple_cat(
std::forward_as_tuple(id, std::forward<decltype(getter_cap)>(getter_cap)),
std::tuple_cat(std::forward_as_tuple(gt_cnv_from_func.template operator()<2 * Is>(tp),
gt_cnv_to_func.template operator()<2 * Is>(tp))...)));
std::apply(
[this](auto&&... args) { _attrSetter.push(std::forward<decltype(args)>(args)...); },
std::tuple_cat(std::forward_as_tuple(id, std::forward<decltype(setter_cap)>(setter_cap)),
std::tuple_cat(std::forward_as_tuple(st_cnv_from_func.template operator()<Is>(tp),
st_cnv_to_func.template operator()<Is>(tp))...)));
std::apply([this](auto&&... args) { _attrSetter.push(std::forward<decltype(args)>(args)...); },
std::tuple_cat(
std::forward_as_tuple(id, std::forward<decltype(setter_cap)>(setter_cap)),
std::tuple_cat(std::forward_as_tuple(st_cnv_from_func.template operator()<2 * Is>(tp),
st_cnv_to_func.template operator()<2 * Is>(tp))...)));
}(std::make_index_sequence<NFUNCS / 2>{});
}