1 // (C) Copyright Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000.
2 // Permission to copy, use, modify, sell and
3 // distribute this software is granted provided this copyright notice appears
4 // in all copies. This software is provided "as is" without express or implied
5 // warranty, and with no claim as to its suitability for any purpose.
7 // See http://www.boost.org for most recent version including documentation.
12 // 19 Feb 2001 Fixed for MSVC (David Abrahams)
14 #ifndef BOOST_SAME_TRAITS_HPP
15 #define BOOST_SAME_TRAITS_HPP
17 #ifndef BOOST_ICE_TYPE_TRAITS_HPP
18 #include <boost/type_traits/ice.hpp>
20 #ifndef BOOST_FWD_TYPE_TRAITS_HPP
21 #include <boost/type_traits/fwd.hpp>
23 #if !defined(BOOST_COMPOSITE_TYPE_TRAITS_HPP) && defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC)
24 #include <boost/type_traits/composite_traits.hpp>
29 /**********************************************
33 **********************************************/
34 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
36 template <typename T, typename U>
38 { BOOST_STATIC_CONSTANT(bool, value = false); };
42 { BOOST_STATIC_CONSTANT(bool, value = true); };
44 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
48 // the following VC6 specific implementation is *NOT* legal
49 // C++, but has the advantage that it works for incomplete
55 struct is_same_part_1 {
56 template<class T2> struct part_2 { enum { value = false }; };
57 template<> struct part_2<T1> { enum { value = true }; };
62 template<class T1, class T2>
64 enum { value = detail::is_same_part_1<T1>::template part_2<T2>::value };
71 ::boost::type_traits::yes_type is_same_helper(T*, T*);
72 ::boost::type_traits::no_type is_same_helper(...);
75 template <typename T, typename U>
82 BOOST_STATIC_CONSTANT(bool, value =
83 (::boost::type_traits::ice_and<
84 (sizeof(type_traits::yes_type) == sizeof(detail::is_same_helper(&t,&u))),
85 (::boost::is_reference<T>::value == ::boost::is_reference<U>::value),
86 (sizeof(T) == sizeof(U))
92 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
96 #endif // BOOST_SAME_TRAITS_HPP