This is Unofficial EPICS BASE Doxygen Site
sp_typeinfo.hpp
Go to the documentation of this file.
1 #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
2 #define BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
3 
4 // MS compatible compilers support #pragma once
5 
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
7 # pragma once
8 #endif
9 
10 // detail/sp_typeinfo.hpp
11 //
12 // Copyright 2007 Peter Dimov
13 //
14 // Distributed under the Boost Software License, Version 1.0.
15 // See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
17 
18 #include <boost/config.hpp>
19 
20 #if defined( BOOST_NO_TYPEID )
21 
23 #include <functional>
24 
25 namespace boost
26 {
27 
28 namespace detail
29 {
30 
31 class sp_typeinfo
32 {
33 private:
34 
35  sp_typeinfo( sp_typeinfo const& );
36  sp_typeinfo& operator=( sp_typeinfo const& );
37 
38  char const * name_;
39 
40 public:
41 
42  explicit sp_typeinfo( char const * name ): name_( name )
43  {
44  }
45 
46  bool operator==( sp_typeinfo const& rhs ) const
47  {
48  return this == &rhs;
49  }
50 
51  bool operator!=( sp_typeinfo const& rhs ) const
52  {
53  return this != &rhs;
54  }
55 
56  bool before( sp_typeinfo const& rhs ) const
57  {
58  return std::less< sp_typeinfo const* >()( this, &rhs );
59  }
60 
61  char const* name() const
62  {
63  return name_;
64  }
65 };
66 
67 template<class T> struct sp_typeid_
68 {
69  static sp_typeinfo ti_;
70 
71  static char const * name()
72  {
74  }
75 };
76 
77 #if defined(__SUNPRO_CC)
78 // see #4199, the Sun Studio compiler gets confused about static initialization
79 // constructor arguments. But an assignment works just fine.
80 template<class T> sp_typeinfo sp_typeid_< T >::ti_ = sp_typeid_< T >::name();
81 #else
82 template<class T> sp_typeinfo sp_typeid_< T >::ti_(sp_typeid_< T >::name());
83 #endif
84 
85 template<class T> struct sp_typeid_< T & >: sp_typeid_< T >
86 {
87 };
88 
89 template<class T> struct sp_typeid_< T const >: sp_typeid_< T >
90 {
91 };
92 
93 template<class T> struct sp_typeid_< T volatile >: sp_typeid_< T >
94 {
95 };
96 
97 template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T >
98 {
99 };
100 
101 } // namespace detail
102 
103 } // namespace boost
104 
105 #define BOOST_SP_TYPEID(T) (boost::detail::sp_typeid_<T>::ti_)
106 
107 #else
108 
109 #include <typeinfo>
110 
111 namespace boost
112 {
113 
114 namespace detail
115 {
116 
117 #if defined( BOOST_NO_STD_TYPEINFO )
118 
119 typedef ::type_info sp_typeinfo;
120 
121 #else
122 
123 typedef std::type_info sp_typeinfo;
124 
125 #endif
126 
127 } // namespace detail
128 
129 } // namespace boost
130 
131 #define BOOST_SP_TYPEID(T) typeid(T)
132 
133 #endif
134 
135 #endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
Definition: assert.hpp:91
#define BOOST_CURRENT_FUNCTION
bool operator==(shared_ptr< T > const &a, shared_ptr< U > const &b) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:733
std::type_info sp_typeinfo
bool operator!=(shared_ptr< T > const &a, shared_ptr< U > const &b) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:738