From: Steven Wat (steven_at_[hidden])
Date: 2007-10-22 11:54:53
Corrado Zoccolo <czoccolo <at> gmail.com> writes:
> Because the vtables in C++ are not smart enough. If I make an hand made
> vtable, I can put not only function pointers, but also values inside it.
> This means that for example, I have to make a call through a function
> pointer to query if the object was allocated on heap or on stack, or if it
> has a no-throw copy constructor (all things that I can put directly in my
> hand made vtable).
There's another reason why a hand-made vtable is preferable
in the general case when you can have arbitrary user-defined
functions. A hand-made vtable allows you to take an arbitrary
subset of the functions without adding more layers of indirection.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk