From: Steven Wat (steven_at_[hidden])
Date: 2007-10-22 11:54:53


AMDG

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.

In Christ,
Steven Watanabe