|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2004-11-04 11:56:29
1) I'm not going to complain about fixing this - thanks
2) This code addresses the issue that (last time I checked)
boost/type_traits/is_abstract.hpp does not work on most compilers. The
intention of this code is to use the boost one where it is known to work and
to use one that returns false if is_abstract is not supported on the
platform. I believe this code supports this intention. There might be a
better way to do this. I don't know if there is a boost macro which does
the job - maybe BOOST_NO_SFNAE. Anyone is free to weigh in on this.
Robert Ramey
"Joaquín Mª López Muñoz" <joaquin_at_[hidden]> wrote in message
news:4189EB3B.F3FB4D3D_at_tid.es...
In MSVC 6.0, the following snippet fails:
#include <boost/archive/text_iarchive.hpp>
#include <boost/tuple/tuple.hpp>
int main()
{
return 0;
}
complaining about is_abstract being already defined. The problem
lies in the following lines inside boost/serialization/is_abstract.hpp:
#ifndef BOOST_TT_IS_ABSTRACT_CLASS_HPP
#if defined(__GNUC__) && (34 <= _GNUC__ * 10 + __GNU_MINOR) \
|| defined(__MSVC_VER) && (1310 <= __MSVC_VER) \
|| defined(__EDG_VERSION__) \
/**/
#include <boost/type_traits/is_abstract.hpp>
#else
// default to false if not supported
namespace boost {
template<class T>
struct is_abstract {
typedef mpl::bool_<false> type;
BOOST_STATIC_CONSTANT(bool, value = is_abstract::type::value);
};
} // namespace boost
#endif
#endif // BOOST_TT_IS_ABSTRACT_CLASS_HPP
The code is *incorrectly* using __MSVC_VER where it should use
_MSVC_VER (just one leading underscore). Thus boost::is_abstract is
defined
twice, as boost/type_traits.hpp is implicitly included by
boost/tupe/tuple.hpp
If nobody complains, I can fix this and commit it to the release and
main branch.
What worries me, though, is that the code above seems flawed to me
(apart from the minor typo). What happens if the compiler is not one of
those
taken care of explicitly in boost/serialization/is_abstract.hpp? Could
anyone
please test the first snippet in some compiler other than MSVC, ICC for
Windows,
GCC or an EDG-based compiler? My thesis is that it will fail.
Thank you,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk