Boost logo

Boost Testing :

From: John Maddock (john_at_[hidden])
Date: 2008-04-06 11:48:14


Robert Ramey wrote:
>> I looked at this. I used the name BOOST_IS_ABSTRACT(T) to permit a
>> user of the serialization library to flag a class as abstract in the
>> absense
>> of support from the compiler.
>> However, that is different than the usage you gave it. I looked at
>> this some more and
>> decided to do the following:
>>
>> a) In the serialization library I changed BOOST_IS_ABSTRACT(T) to
>> BOOST_SERIALIZATION_ASSUME_ABSTRACT(T)
>> b) changed a boost::serializaton::is_abstract to BOOST_IS_ABSTRACT(T)

That's not the way that macro is supposed to be used, it's an internal
detail of the type_traits library such that: when defined it evaluates to
the compiler intrinsic for the is_abstract trait, boost::is_abstract can
simply it's implementation to just be in terms of BOOST_IS_ABSTRACT.
However, when there is no compiler intrinsic, then the macro
BOOST_IS_ABSTRACT *is not defined*, and boost::is_abstract uses it's own
implementation methods.

>> I tested this on my msvc 7.1 system ans well as msvc 9.0. With msvc
>> 7.1 I had no problem.

The I assume you're using boost::is_abstract<> rather than the macro?

>> With vc 9.0 I had some problems.
>>
>> a) Looking through the code in intrinsics.hpp it looks like at some
>> point BOOST_IS_ABSTRACT(T) is defined so that is resolves to
>> is_polymorphic. If my understanding of this is correct, its really
>> a bad idea.

No, but boost::is_abstract<> may equate to is_polymorphic<> if we can't
implement is_abstract (but this only applies to old broken compilers). I
seem to remember we had a long discussion about this when is_abstract was
reviewed, and this came up as the least-worst solution. You can detect for
this case by checking to see if BOOST_NO_IS_ABSTRACT is defined - when set
then is_abstract can't be implemented on that compiler, and it defaults to
the same behaviour as is_polymorphic, you could do something different in
this case of course.

>> Attached is what I want to use in the serialization library - but it
>> won't build on msvc 9.0. I bails at
>>
>> // required by smart_cast for compilers not implementing
>> // partial template specialization
>> BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
>> boost::archive::detail::basic_iarchive
>> )
>>
>> Which sort of mystifies me.

Um don't you need to define a serialization::is_abstract that forwards to
boost::is_abstract? See attached, also uses BOOST_NO_IS_ABSTRACT, but
untested!

HTH, John.




Boost-testing list run by mbergal at meta-comm.com