-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Hi,
I am having a hard time writing tuple constructors using reflection and/or metaprogramming. With metaprogramming, you can imagine structs as
template<typename... Ts>
struct tuple
{
// ... some operators
// And then data members that are generated as something like
T0 m0;
T1 m1;
// ...
};How would I write the variadic constructors? For instance
template<typename... Us>
constexpr tuple(Us&&... args);I was thinking of constructing something like
inline constexpr std::size_t index[3] = {0, 1, 2};And then use that to generate something like
template <typename A0, typename A1, typename A2>
constexpr Tuple(A0&& a0, A1&& a1, A2&& a2)
: m0(std::forward<A0>(a0)),
m1(std::forward<A1>(a1)),
m2(std::forward<A2>(a2)) {}I believe this should be possible. But I currently fail to see how to do it?
I cannot use fragments to create such lists as far as I can tell.
And I might miss something when trying to use pack expansion...
Cheers,
Roland
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels