|
Boost : |
Subject: Re: [boost] Request For a feature - Templated virtual functions
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-02-12 05:30:09
Gokulakannan Somasundaram wrote:
> Thanks for pointing me to Boost.Variant. But let me just try to clarify my
> understanding on Boost Variant. It is a kind of union data type, where we
> store the data and its type together. Whenever we retrieve the data, it does
> a switch-case lookup and type-casts the data to that type. In my opinion,
> the switch-case is equivalent to a virtual table lookup. They should be
> having more or less the same runtime penalty.
Indeed.
A switch-case is actually faster than a virtual table lookup, however.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk