Subject: Re: [boost] Request For a feature - Templated virtual functions
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-02-12 09:58:24


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.