
12 Feb
2009
12 Feb
'09
2:58 p.m.
Niels Dekker - mail address until 2010-10-10 wrote:
Mathias Gaunard wrote:
A switch-case is actually faster than a virtual table lookup, however.
Is that independent of the number of cases?
Both are constant-time. Nothing prevents a compiler to implement a switch/case with virtual functions, (well actually scope might be an issue, but circumventable), but typically it will do smarter things that do not prevent inlining for example.