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:
> 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.
Actually, Andy Little did a comparison which showed the switch was
faster than the array:

Boost list run by bdawes at, gregod at, cpdaniel at, john at