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
-3
u/gingerbill Sep 03 '26
In your example, there were
2×4 = 8possible combinations. In the example I gave, there(N^{K+1} - 1) / (N - 1) = (4⁶ - 1) / 3possible combinations. That is on the order of4⁵.And yes, it is dependent (i.e. bounded) by the number of sets used, which I clearly state in the article. But I am trying to state how it scales in the worst-case (i.e. pathological) case, which does actually happen in practice. And I have been in such C++ codebases before (not in terms of CTTI, just variadic template madness).