Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-13 15:59:52


----- Original Message -----
From: "Lee Brown" <lee_at_[hidden]>

> > template <class T>
> > struct is_polymorphic
> > {
> > struct d1 : public T
> > {
> > d1();
> > char padding[256];
> > };
> > struct d2 : public T
> > {
> > d2();
> > virtual ~d2();
> > virtual void foo();
> > char padding[256];
> > };
> > BOOST_STATIC_CONSTANT(bool, value = (sizeof(d2) == sizeof(d1)));
> > };
>
> This reminds me of the guy who got wings and flew too close to the sun.
> I understand that a programmer sometimes has got to do what he's got to
> do, but .... C++ was designed to avoid this sort of hack.

I have to disagree. If it were designed to avoid it, we would have a
portable, standard way to do things like this - one that doesn't instantiate
3 more classes than neccessary. Maybe in the next standard...

-Dave


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