$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-11 09:10:14
----- Original Message -----
From: "John Maddock" <John_Maddock_at_[hidden]>
> Funny you should mention that, I came up with a reasonably protable
> implementation for that the other day - I just haven't had a chance to try
> it out.  Heres my rather quickly knocked up code:
>
> #include <boost/type_traits.hpp>
> #include <boost/type_traits/type_traits_test.hpp>
>
> 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)));
> };
By the way, what's the padding for?
-Dave