C++26 is seeing some progress in making template parameter packs more ergonomic. For example P2662: Pack indexing has been accepted into the standard.
With this and other related proposals, what's the most simple tuple
implementation one could make?
I'm envisioning something along the lines of:
template <typename... T>
struct tuple {
T... m;
};
tuple<int, float> tup{};
float f = tup.m[1];
Will it be possible to write something like this? If not exactly with this syntax, then how? If not at all, what proposals are missing to make this happen?
Here you go:
I'm half-joking, obviously. But you could create a template class that wraps such lambdas and gives them a decent interface.