Boost logo

Boost :

Subject: Re: [boost] is_virtual_base_of ?
From: Daniel Frey (d.frey_at_[hidden])
Date: 2009-03-11 14:02:36


On 11.03.2009, at 19:18, Robert Ramey wrote:

> My current version - checked into the trunk at
> boost/serialization/is_virtual_base_of.hpp is attached. I think it
> addresses the points mentioned here.
>
> I can fix the case that causes me problems by adding a default
> constructor
> which is never called. That doesn't help for the generic case
> though. I'm
> guessing that type traits has lots of situations where members are
> declared
> and never called.

You probably misunderstood the idea, as it is really generic. The idea
is to add a declaration (without a definition) of X's ctor (or any
other generated methods that cause you trouble). To be more precise:

Index: boost/serialization/is_virtual_base_of.hpp
===================================================================
--- boost/serialization/is_virtual_base_of.hpp (revision 51709)
+++ boost/serialization/is_virtual_base_of.hpp (working copy)
@@ -29,7 +29,7 @@
  template<typename Base, typename Derived>
  struct is_virtual_base_of_impl
  {
- struct X : Derived, virtual Base {};
+ struct X : Derived, virtual Base { X(); };
      BOOST_STATIC_CONSTANT(bool, value = sizeof(X)==sizeof(Derived));
  };

HTH, Daniel


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