Boost logo

Boost Users :

From: Martin Apel (martin.apel_at_[hidden])
Date: 2007-08-21 09:59:39


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_typetraits.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 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