0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd:🆑 Add variadic argument template pack construction.

This commit is contained in:
Jason Volk 2021-03-13 23:14:26 -08:00
parent c7fa7a07ee
commit 44521ce019

View file

@ -100,6 +100,7 @@ struct ircd::cl::kern
public:
void arg(const int, data &);
template<class... argv> kern(code &, const string_view &name, argv&&...);
kern(code &, const string_view &name);
kern() = default;
kern(kern &&) noexcept;
@ -195,3 +196,24 @@ noexcept
other.context = nullptr;
return *this;
}
template<class... argv>
inline
ircd::cl::kern::kern(code &c,
const string_view &name,
argv&&... a)
:kern{c, name}
{
constexpr uint argc
{
sizeof...(a)
};
data *const datas[argc]
{
std::addressof(a)...
};
for(uint i(0); i < argc; ++i)
this->arg(i, *datas[i]);
}