Boost logo

Boost :

From: Stefan Slapeta (stefan_at_[hidden])
Date: 2003-12-21 12:03:29


// -----Original Message-----
// From: boost-bounces_at_[hidden]
// [mailto:boost-bounces_at_[hidden]] On Behalf Of David Abrahams

// You should really post a test which demonstrates the
// problem. Then we'll be able to see what contexts it appears in.
//

Here you are (simplified excerpt of is_polymorphic.hpp):

#include <iostream>

template <class T>
struct Polymorphic_Test
{
   struct d1 : public T
   {
      d1();
      ~d1()throw();
      char padding[256];
   };
   struct d2 : public T
   {
      d2();
      virtual ~d2()throw();
      struct unique{};
      virtual void foo(unique*);
      char padding[256];
   };

   static const int size_d1 = sizeof(d1);
   static const int size_d2 = sizeof(d2);

   static const bool value = (size_d1 == size_d2);
};

int main()
{
        // should be equal
        int s1 = Polymorphic_Test<std::iostream>::size_d1;
        int s2 = Polymorphic_Test<std::iostream>::size_d2;

        // should be 1
        int isPoly = Polymorphic_Test<std::iostream>::value;
}


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