Boost logo

Boost :

From: Johan Nilsson (johan.nilsson_at_[hidden])
Date: 2002-12-10 07:38:06


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:00bb01c2a046$671b1c20$1d00a8c0_at_pdimov2...
> From: "Johan Nilsson" <johan.nilsson_at_[hidden]>
> [...]
> > template<typename T>
> > T* dynamic_void_cast(void* pv)
> > {
> > struct rtti_obj__
> > {
> > virtual ~rtti_obj__() = 0;
> > };
> >
> > rtti_obj__* pro = static_cast<rtti_obj__*>(pv);
> >
> > try
> > {
> > return dynamic_cast<T*>(pro);
> > }
>
> This is not required to work. T's vtable pointer is not guaranteed to be
at
> offset 0.
>

But I thought that it _might_ be required to be at the same offset for T as
for rtti_obj. For that part, IIRC, a vtable isn't required at all, or?

// Johan


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