Boost logo

Boost Users :

From: Hughes, James (jhughes_at_[hidden])
Date: 2007-08-21 10:37:34


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Martin Apel
> Sent: 21 August 2007 15:00
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [mpl] Is it possible to mpl_assert
> dependingonthe derivation of a class
>
> Hughes, James wrote:
> >
> > Just a quick addendum to this. I tried out a combination of the
> > two - using a BOOST_STATIC_ASSERT((boost::is_base_of<Base, T>
> > >::value)) inside the do_it function described above, and found
> > what I thought was odd behaviour with is_base_of.
> >
> > The following excerpt shows the behaviour
> >
> > class A {};
> >
> > class B : public A {};
> >
> > typedef A C;
> >
> > BOOST_STATIC_ASSERT((boost::is_base_of<A,B> >::value))
> // this
> > passes
> >
> > BOOST_STATIC_ASSERT((boost::is_base_of<A,C> >::value))
> // this
> > fails
> >
> > I would expect both to pass, as is_base_of should
> return true when
> > both parameters are the same, and I thought that
> typedef did make
> > classes the same/equivalent
> >
> >
> >
> http://www.boost.org/doc/html/boost_typetraits/reference.html#boost_ty
> > petraits.is_base_of
> >
> > Is there something I am missing about typedef? Or is
> > boost::is_base_of unable to handles the aliasing?
> >
> > James
> >
> >
> >
> Hi James,
>
> I tried this with GCC 4.2 and 3.4.6 under Linux. It passes
> for both cases. So it might be your compiler, which is doing
> something wrong.
>
> Martin
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>

I'm using gcc 3.4.3 (Cross compiler to Arm). I had a thought it might be
down to having some pure virtual functions in A, which meant that my
typedef resulting in an incomplete type, but I removed those as a test
and still got the same error. But that wouldn't explain why changing
from a typedef to a derivation fixed the problem.

Using boost 1.33.1 btw.

I'll assume it's the compiler for now!!

James

This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law. If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system. If you
have any questions about this e-mail please notify the sender
immediately.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net