]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/type_traits/is_base_and_derived.hpp
update boost to version 1.36
[lyx.git] / boost / boost / type_traits / is_base_and_derived.hpp
index 48d10280522f1959f8f60ed3e7e0fd7276cd7573..57a5113b79bee96759aea0ead5e07782636cd24e 100644 (file)
@@ -9,12 +9,16 @@
 #ifndef BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED
 #define BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED
 
+#include <boost/type_traits/intrinsics.hpp>
+#ifndef BOOST_IS_BASE_OF
 #include <boost/type_traits/is_class.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #include <boost/type_traits/detail/ice_and.hpp>
 #include <boost/type_traits/remove_cv.hpp>
 #include <boost/config.hpp>
+#include <boost/static_assert.hpp>
+#endif
 
 // should be the last #include
 #include <boost/type_traits/detail/bool_trait_def.hpp>
@@ -23,6 +27,7 @@ namespace boost {
 
 namespace detail {
 
+#ifndef BOOST_IS_BASE_OF
 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) \
  && !BOOST_WORKAROUND(__SUNPRO_CC , <= 0x540) \
  && !BOOST_WORKAROUND(__EDG_VERSION__, <= 243) \
@@ -128,6 +133,17 @@ struct bd_helper
 template<typename B, typename D>
 struct is_base_and_derived_impl2
 {
+#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
+#pragma warning(push)
+#pragma warning(disable:6334)
+#endif
+    //
+    // May silently do the wrong thing with incomplete types
+    // unless we trap them here:
+    //
+    BOOST_STATIC_ASSERT(sizeof(B) != 0);
+    BOOST_STATIC_ASSERT(sizeof(D) != 0);
+
     struct Host
     {
 #if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
@@ -140,6 +156,9 @@ struct is_base_and_derived_impl2
 
     BOOST_STATIC_CONSTANT(bool, value =
         sizeof(bd_helper<B,D>::check_sig(Host(), 0)) == sizeof(type_traits::yes_type));
+#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
+#pragma warning(pop)
+#endif
 };
 
 #else
@@ -199,7 +218,13 @@ struct is_base_and_derived_impl
 
     BOOST_STATIC_CONSTANT(bool, value = bound_type::value);
 };
-
+#else
+template <typename B, typename D>
+struct is_base_and_derived_impl
+{
+    BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_BASE_OF(B,D));
+};
+#endif
 } // namespace detail
 
 BOOST_TT_AUX_BOOL_TRAIT_DEF2(
@@ -220,4 +245,3 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_a
 #include <boost/type_traits/detail/bool_trait_undef.hpp>
 
 #endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED
-