mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
ircd:🆑 Add variadic argument template pack construction.
This commit is contained in:
parent
c7fa7a07ee
commit
44521ce019
1 changed files with 22 additions and 0 deletions
|
@ -100,6 +100,7 @@ struct ircd::cl::kern
|
||||||
public:
|
public:
|
||||||
void arg(const int, data &);
|
void arg(const int, data &);
|
||||||
|
|
||||||
|
template<class... argv> kern(code &, const string_view &name, argv&&...);
|
||||||
kern(code &, const string_view &name);
|
kern(code &, const string_view &name);
|
||||||
kern() = default;
|
kern() = default;
|
||||||
kern(kern &&) noexcept;
|
kern(kern &&) noexcept;
|
||||||
|
@ -195,3 +196,24 @@ noexcept
|
||||||
other.context = nullptr;
|
other.context = nullptr;
|
||||||
return *this;
|
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]);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue