r/programming • u/gingerbill • Sep 02 '26
CTTI is Exponential, RTTI is Linear
https://www.gingerbill.org/article/2026/09/02/ctti-is-exponential-rtti-is-linear/
96
Upvotes
r/programming • u/gingerbill • Sep 02 '26
View all comments
Show parent comment
8
u/QuaternionsRoll Sep 03 '26
>Please making a general print procedure for ANY type that will print out the structure of the type itself.
You can’t, but that’s only because C++ doesn’t have a global reflection apparatus (for various reasons, the most obvious of which is C compatibility). Newer languages like Rust had the opportunity to add such RTTI via e.g. `dyn Any`, but elected not to on the basis that it turns out to not be all that useful.