C++ Logo

std-proposals

Advanced search

Re: [std-proposals] revision of p4198r0

From: Muneem <itfllow123_at_[hidden]>
Date: Wed, 04 Nov 2026 18:44:12 +0500
Previously on the discussion forum, I tried to begin a discussion on a
potential interpreter engine in C++. In doing so, I also mistakenly
reinvented std::visit (the code is now at
https://github.com/HjaldrKhilji/C-and-C-plus-plus-notes/blob/main/std%3A%3Avisit%20implementation%20with%20reflections
) to make the jump table flat for a binary operation, aiming for better
cache locality and branch prediction.

However, I soon realized that my previous proposal
(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4198r0.pdf)
is already sufficient for an interpreter engine, and all one needs is
to make use of C++26 features. I also realized that reinventing
std::visit is completely useless unless for personal use (where, if the
standard implementation fails to make the jump table flat, then it
might be worth it for binary operations).
This led me to a revision of my proposal. It is currently incomplete,
but I have prototyped it here: https://godbolt.org/z/Ksz4eheP7 (or for
the constantly updated version:
https://github.com/HjaldrKhilji/C-and-C-plus-plus-notes/blob/main/std%3A%3Avisit%20implementation%20with%20reflections
).

Since this idea may be out of scope for a runtime tuple, I want to get
some helpful criticism so I know how to take this forward.
My goal: As always with my contributions to the C++ mailing list, my
goal is to provide stronger dynamic support for runtime objects. If a
feature like this is accepted, we won't just have a heterogeneous list,
but rather a complete, runtime-typed parser. Once it gains enough
consensus, I will draft a revision of my previous proposal and publish
it again.

Thank you for reading this far.

Received on 2026-11-04 13:44:17