New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
is_same.hpp in vendors/XIOS/current/extern/boost/include/boost/type_traits – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/type_traits/is_same.hpp @ 3408

Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1
2//  (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes,
3//      Howard Hinnant and John Maddock 2000.
4//  (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 2001
5
6//  Use, modification and distribution are subject to the Boost Software License,
7//  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8//  http://www.boost.org/LICENSE_1_0.txt).
9//
10//  See http://www.boost.org/libs/type_traits for most recent version including documentation.
11
12//    Fixed is_pointer, is_reference, is_const, is_volatile, is_same,
13//    is_member_pointer based on the Simulated Partial Specialization work
14//    of Mat Marcus and Jesse Jones. See  http://opensource.adobe.com or
15//    http://groups.yahoo.com/group/boost/message/5441
16//    Some workarounds in here use ideas suggested from "Generic<Programming>:
17//    Mappings between Types and Values"
18//    by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html).
19
20
21#ifndef BOOST_TT_IS_SAME_HPP_INCLUDED
22#define BOOST_TT_IS_SAME_HPP_INCLUDED
23
24#include <boost/type_traits/config.hpp>
25#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
26#include <boost/type_traits/detail/yes_no_type.hpp>
27#include <boost/type_traits/detail/ice_and.hpp>
28#include <boost/type_traits/is_reference.hpp>
29#endif
30// should be the last #include
31#include <boost/type_traits/detail/bool_trait_def.hpp>
32
33namespace boost {
34
35#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
36
37BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_same,T,U,false)
38BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T,T,true)
39#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
40// without this, Borland's compiler gives the wrong answer for
41// references to arrays:
42BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T&,T&,true)
43#endif
44
45#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
46
47namespace detail {
48
49#ifdef BOOST_MSVC
50// the following VC6 specific implementation is *NOT* legal
51// C++, but has the advantage that it works for incomplete
52// types.
53
54template< typename T1 >
55struct is_same_part_1
56{
57    template<typename T2>  struct part_2     { enum { value = false }; };
58    template<>             struct part_2<T1> { enum { value = true }; };
59};
60
61template< typename T1, typename T2 >
62struct is_same_impl
63{
64    enum { value = boost::detail::is_same_part_1<T1>::template part_2<T2>::value };
65};
66
67#else // generic "no-partial-specialization" version
68
69template <typename T>
70::boost::type_traits::yes_type
71BOOST_TT_DECL is_same_tester(T*, T*);
72
73::boost::type_traits::no_type
74BOOST_TT_DECL is_same_tester(...);
75
76template <typename T, typename U>
77struct is_same_impl
78{
79   static T t;
80   static U u;
81
82   BOOST_STATIC_CONSTANT(bool, value =
83      (::boost::type_traits::ice_and<
84         (sizeof(type_traits::yes_type) == sizeof(boost::detail::is_same_tester(&t,&u))),
85         (::boost::is_reference<T>::value == ::boost::is_reference<U>::value),
86         (sizeof(T) == sizeof(U))
87        >::value));
88};
89
90#endif // BOOST_MSVC
91
92} // namespace detail
93
94BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_same,T,U,(::boost::detail::is_same_impl<T,U>::value))
95
96#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
97
98} // namespace boost
99
100#include <boost/type_traits/detail/bool_trait_undef.hpp>
101
102#endif  // BOOST_TT_IS_SAME_HPP_INCLUDED
103
Note: See TracBrowser for help on using the repository browser.