Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2003-04-07 00:55:09


> > So the tradeoff here is extra 4 bytes for the object size plus double
> > indirection for all access operations. Here the question arise then why
> not
> > use virtual function based solution then? I bet it will be incomparably
> more
> > simple to understand and probably easier to use.
>
> I'm not quite sure how virtual functions will solve anything, but I am
eager
> to understand if indeed they will.
>
> Please explain.

Well polymorphic objects is not that brand new idea in C++. We used to
implement this kind of design using abstract based class with virtual
function interface (unless we are using unions of course). This solution has
it's drawbacks and it's advantages (mostly simplicity to understand and
use). So with above tradeoff in effect I question what would be more
appropriate to use: boost::variant based solution or legacy one.

Gennadiy.


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