Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-12-10 10:45:55


On 12/10/2005 09:09 AM, Yuval Ronen wrote:
> Paul Mensonides wrote:
>
>>I haven't really been following this conversion, but why do you need an array at
>>all? You have a sequence containing enumerator names. You can generate a
>>switch statement just as easily as you can the enum itself:
[snip]
> One point in favour of array, is that it ensures us of O(1) lookup time.
> A good compiler might do that with switch/case but I'm not sure it's
> something that we can rely on.
[snip]
Actually, Andy Little did a comparison which showed the switch was
faster than the array:

http://groups.google.com/group/comp.lang.c++.moderated/msg/6de73412e552c387


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk