Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-08-10 00:54:32


Robert Ramey wrote:

>> Just try a file containing two lines:
>>
>> #include <boost/type_traits/is_abstract.hpp>
>> #include <boost/archive/binary_iarchive.hpp>
>
> I see the problem now.
>
>> Why serialization/is_abstract.hpp is in better position to handle such
>> compilers then type_traits/is_abstract.hpp? I'm not saying that my
>> patch
>> is ideal, but having two headers for the same purpose is very bad
>> idea, IMO.
>
> agreed.
>
> Its just an oversight which requires some thought to fix. A little
> background.
>
> a) I need a type trait to determine whether or not a base class could be
> instanticiated. I believe I needed this to implement base_object.
>
> b) I found and implementation of is_abstract. It was interesting but only
> worked on some compilers. So I made serialization::is_abstract which
> defaulted to false. For compilers not supporting is_abstract and for
> portable code, is_abstract has to be overloaded.
>
> c) eventually, is_abstract got fixed up in such a way that for compilers
> not
> supporting it, it returns the result of is_polymorphic. I missed the
> discussion.
>
> So it has come to pass that the type_traits is_abstract and serialization
> is_abstract are different and have different defaults for non-conforming
> compilers.
> I only just found out about this problem, and I haven't had
> time to think about how to address it.

You can #ifndef BOOST_NO_IS_ABSTRACT, I believe.

> Of course the type traits implementation isn't going to be very useful
> given
> that it silently gives the wrong result for many compilers. From my
> perspective, it would have been better to static assert if one tried to
> use is_abstract default on a non-conforming compiler.

Please note it's not "non-conforming" compiler. My understanding is that
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#337 which is
used to detect abstract types, is not part of any official C++ standard, so
compilers are not required to support this.

> The problem should only occur in modules which include both serialization
> and type traits is_abstract. That fact might be of some consolation.

I'm afraid no, I don't include type_traits/is_abstract.hpp directly, and I
have no idea how it's got included. I just get a compile error.

- Volodya


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