forked from qt-creator/qt-creator
Utils: Dismantle ArgTuple
Change-Id: I5810beef15956fb067dece35f59aecaa26149dea Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -25,13 +25,6 @@ public:
|
|||||||
const Arg arg; // FIXME: Could be const &, but this would currently break bindTo().
|
const Arg arg; // FIXME: Could be const &, but this would currently break bindTo().
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename ...Args>
|
|
||||||
struct ArgTuple
|
|
||||||
{
|
|
||||||
ArgTuple(Args &&...args) : args(std::forward<Args>(args)...) {}
|
|
||||||
const std::tuple<std::decay_t<Args>...> args;
|
|
||||||
};
|
|
||||||
|
|
||||||
// The main dispatcher
|
// The main dispatcher
|
||||||
|
|
||||||
void doit(auto x, auto id, auto p);
|
void doit(auto x, auto id, auto p);
|
||||||
@@ -60,11 +53,11 @@ public:
|
|||||||
class name##_TAG {}; \
|
class name##_TAG {}; \
|
||||||
template <typename ...Args> \
|
template <typename ...Args> \
|
||||||
inline auto name(Args &&...args) { \
|
inline auto name(Args &&...args) { \
|
||||||
return Building::IdAndArg{name##_TAG{}, Building::ArgTuple<Args...>{std::forward<Args>(args)...}}; \
|
return Building::IdAndArg{name##_TAG{}, std::tuple<Args...>{std::forward<Args>(args)...}}; \
|
||||||
} \
|
} \
|
||||||
template <typename L, typename ...Args> \
|
template <typename L, typename ...Args> \
|
||||||
inline void doit(L *x, name##_TAG, const Building::ArgTuple<Args...> &arg) { \
|
inline void doit(L *x, name##_TAG, const std::tuple<Args...> &arg) { \
|
||||||
std::apply(&L::setter, std::tuple_cat(std::make_tuple(x), arg.args)); \
|
std::apply(&L::setter, std::tuple_cat(std::make_tuple(x), arg)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Building
|
} // Building
|
||||||
|
Reference in New Issue
Block a user