QGIM: simplify call-helper

Use the helpers we have to unify calling with either pointer or
reference.

Change-Id: I1f1dec6095d913d9af4d8f427f05d8893a06ef76
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Artem Dyomin 2025-04-02 16:53:21 +02:00 committed by Volker Hilsheimer
parent 0c6c49849d
commit 5898d8da9a

View File

@ -500,15 +500,10 @@ protected:
template <typename Tuple, typename F, size_t ...Is>
static void call_at(Tuple &&tuple, size_t idx, std::index_sequence<Is...>, F &&function)
{
((Is == idx ? static_cast<void>(function(get<Is>(std::forward<Tuple>(tuple))))
: static_cast<void>(0)), ...);
}
template <typename Tuple, typename F, size_t ...Is>
static void call_at(Tuple *tuple, size_t idx, std::index_sequence<Is...> seq, F &&function)
{
if (tuple)
call_at(*tuple, idx, seq, std::forward<F>(function));
if (QGenericItemModelDetails::isValid(tuple))
((Is == idx ? static_cast<void>(function(get<Is>(
QGenericItemModelDetails::refTo(std::forward<Tuple>(tuple)))))
: static_cast<void>(0)), ...);
}
template <typename T, typename F>