diff --git a/include/boost/detail/ob_type_traits.hpp b/include/boost/detail/ob_type_traits.hpp index 31845c1..8be87ec 100644 --- a/include/boost/detail/ob_type_traits.hpp +++ b/include/boost/detail/ob_type_traits.hpp @@ -10,6 +10,11 @@ // support partial specialisation. (C) John Maddock 2000 /* Release notes: + 20 Jan 2001: + Fixed is_same so it would work with T == void or U == void + Suppressed some warnings in from_not_void_conversion<> for MSVC + Fixed a spelling error + (David Abrahams) 07 Oct 2000: Added more fixes for is_array (based on a newgroup posting by Jonathan Lundquist). 03 Oct 2000: @@ -22,7 +27,7 @@ on the boost list (Copyright 2000 Adobe Systems Incorporated and others. All rights reserved.). 31st July 2000: - Added is_convertable, alignment_of. + Added is_convertible, alignment_of. 23rd July 2000: Fixed is_void specialization. (JM) */ @@ -42,10 +47,11 @@ // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. - #ifndef BOOST_OB_TYPE_TRAITS_HPP #define BOOST_OB_TYPE_TRAITS_HPP +#include + #ifndef BOOST_TYPE_TRAITS_HPP #error Internal header file: This header must be included by only. #endif @@ -124,18 +130,30 @@ namespace detail{ template yes_result is_same_helper(T*, T*); no_result is_same_helper(...); + + template + struct size_of + { + enum { value = sizeof(T) }; + }; + + template <> + struct size_of + { + enum { value = 0 }; + }; } template struct is_reference; template struct is_same { private: - static T t; - static U u; + static type t; + static type u; public: enum{ value = (sizeof(detail::yes_result) == sizeof(detail::is_same_helper(&t,&u))) & (is_reference::value == is_reference::value) - & (sizeof(T) == sizeof(U)) }; + & (detail::size_of::value == detail::size_of::value) }; }; template struct is_void{ enum{ value = false }; }; @@ -413,7 +431,14 @@ namespace detail{ public: void foo(); // avoid warning about all members being private static From from; +# ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4244 4245 4135 4136 4051 4134) // disable all conversion warnings +# endif enum { exists = sizeof( check(from) ) == sizeof(yes_result) }; +# ifdef BOOST_MSVC +# pragma warning(pop) +# endif }; }; struct from_is_void_conversion {