Boost logo

Boost :

Subject: Re: [boost] is_virtual_base_of ?
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-03-11 14:18:06


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.

FWIW - the reason I really need this is that I've implemented a much needed
improvement in the speed of void_cast. But it can't be applied to
void_casts to virtual base classes so I need to use another method. So I
need this to invoke the proper method.

Robert Ramey

Matt Calabrese wrote:
> On Wed, Mar 11, 2009 at 12:22 PM, John Maddock
> <john_at_[hidden]>wrote:
>
>> I'm still having some problems with this. Some compilers are
>> flaging as an
>>> error
>>> the case where B doesn't have a default constructor.
>>>
>>
>> Rightly too I suspect :-(
>
>
> I don't think that should be an error -- a warning, maybe, but not an
> error. We are never actually creating an instance of X anywhere so
> there is no actual problem.
>
> Another thing that should probably be handled is yielding false when D
> and/or B is not a class type rather than error. Also, it might be
> better to reorder the template arguments so that it is "Base,
> Derived" not "Derived, Base" as the name suggests and to be
> consistent with is_base_of.

begin 666 is_virtual_base_of.hpp
M+R\@("A#*2!#;W!Y<FEG:'0_at_1&%N:65L($9R97D_at_86YD(%)O8F5R="!286UE
M>2 R,# Y+@T*+R\@(%5S92P@;6]D:69I8V%T:6]N(&%N9"!D:7-T<FEB=71I
M;VX_at_87)E('-U8FIE8W0@=&\@=&AE($)O;W-T(%-O9G1W87)E($QI8V5N<V4L
M#0HO+R @5F5R<VEO;B Q+C N("A3964_at_86-C;VUP86YY:6YG(&9I;&4_at_3$E#
M14Y315\Q7S N='AT(&]R(&-O<'D_at_870-"B\O("!H='1P.B\O=W=W+F)O;W-T
M+F]R9R],24-%3E-%7S%?,"YT>'0I+@T*+R\-"B\O("!3964@:'1T<#HO+W=W
M=RYB;V]S="YO<F<O;&EB<R]T>7!E7W1R86ET<R!F;W(@;6]S="!R96-E;G0@
M=F5R<VEO;B!I;F-L=61I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I]("\O(&YA
M;65S<&%C92!D971A:6P-"@T*0D]/4U1?5%1?05587T)/3TQ?5%)!251?1$5&
M,B_at_-"B @(" @(&ES7W9I<G1U86Q?8F%S95]O9_at_T*(" @("P_at_0F%S90T*(" @
M("P_at_1&5R:79E9 T*(" @("P@*#HZ8F]O<W0Z.G1Y<&5?=')A:71S.CII8V5?
M86YD/" @(" @( T*(" @(" @(" @*#HZ8F]O<W0Z.F1E=&%I;#HZ:7-?=FER
M='5A;%]B87-E7V]F7VEM<&P\0F%S92Q$97)I=F5D/CHZ=F%L=64I+ T*(" @
M(" @(" @*#HZ8F]O<W0Z.G1Y<&5?=')A:71S.CII8V5?;F]T/ T*(" @(" @
M(" @(" @*#HZ8F]O<W0Z.FES7W-A;64\0F%S92Q$97)I=F5D/CHZ=F%L=64I
M#0H@(" @(" @(" ^.CIV86QU92D-"B @(" ^.CIV86QU92D-"BD-"@T*(VEF
M;F1E9B!"3T]35%].3U]414U03$%415]005)424%,7U-014-)04Q)6D%424].
M#0I"3T]35%]45%]!55A?0D]/3%]44D%)5%]005)424%,7U-014,R7S(H='EP
M96YA;64_at_0F%S92QT>7!E;F%M92!$97)I=F5D+&ES7W9I<G1U86Q?8F%S95]O
M9BQ"87-E)BQ$97)I=F5D+&9A;'-E*0T*0D]/4U1?5%1?05587T)/3TQ?5%)!
M251?4$%25$E!3%]34$5#,E\R*'1Y<&5N86UE($)A<V4L='EP96YA;64_at_1&5R
M:79E9"QI<U]V:7)T=6%L7V)A<V5?;V8L0F%S92Q$97)I=F5D)BQF86QS92D-
M"D)/3U-47U147T%56%]"3T],7U1204E47U!!4E1)04Q?4U!%0S)?,BAT>7!E
M;F%M92!"87-E+'1Y<&5N86UE($1E<FEV960L:7-?=FER='5A;%]B87-E7V]F
M+$)A<V4F+$1E<FEV960F+&9A;'-E*0T*(V5N9&EF#0H-"GT@+R\@;F%M97-P
M86-E(&)O;W-T#0H-"B-I;F-L=61E(#QB;V]S="]T>7!E7W1R86ET<R]D971A
D:6PO8F]O;%]T<F%I=%]U;F1E9BYH<' ^#0H-"B-E;F1I9_at_T*
`
end


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