Project revived from Feb2017
[EroSomnia.git] / deps / boost_1_63_0 / boost / core / typeinfo.hpp
blobe67b4a3198be1757a345dcdd74710b9fc907df18
1 #ifndef BOOST_CORE_TYPEINFO_HPP_INCLUDED
2 #define BOOST_CORE_TYPEINFO_HPP_INCLUDED
4 // MS compatible compilers support #pragma once
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
7 # pragma once
8 #endif
10 // core::typeinfo, BOOST_CORE_TYPEID
12 // Copyright 2007, 2014 Peter Dimov
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)
18 #include <boost/config.hpp>
20 #if defined( BOOST_NO_TYPEID )
22 #include <boost/current_function.hpp>
23 #include <functional>
25 namespace boost
28 namespace core
31 class typeinfo
33 private:
35 typeinfo( typeinfo const& );
36 typeinfo& operator=( typeinfo const& );
38 char const * name_;
40 public:
42 explicit typeinfo( char const * name ): name_( name )
46 bool operator==( typeinfo const& rhs ) const
48 return this == &rhs;
51 bool operator!=( typeinfo const& rhs ) const
53 return this != &rhs;
56 bool before( typeinfo const& rhs ) const
58 return std::less< typeinfo const* >()( this, &rhs );
61 char const* name() const
63 return name_;
67 inline char const * demangled_name( core::typeinfo const & ti )
69 return ti.name();
72 } // namespace core
74 namespace detail
77 template<class T> struct core_typeid_
79 static boost::core::typeinfo ti_;
81 static char const * name()
83 return BOOST_CURRENT_FUNCTION;
87 #if defined(__SUNPRO_CC)
88 // see #4199, the Sun Studio compiler gets confused about static initialization
89 // constructor arguments. But an assignment works just fine.
90 template<class T> boost::core::typeinfo core_typeid_< T >::ti_ = core_typeid_< T >::name();
91 #else
92 template<class T> boost::core::typeinfo core_typeid_< T >::ti_(core_typeid_< T >::name());
93 #endif
95 template<class T> struct core_typeid_< T & >: core_typeid_< T >
99 template<class T> struct core_typeid_< T const >: core_typeid_< T >
103 template<class T> struct core_typeid_< T volatile >: core_typeid_< T >
107 template<class T> struct core_typeid_< T const volatile >: core_typeid_< T >
111 } // namespace detail
113 } // namespace boost
115 #define BOOST_CORE_TYPEID(T) (boost::detail::core_typeid_<T>::ti_)
117 #else
119 #include <boost/core/demangle.hpp>
120 #include <typeinfo>
122 namespace boost
125 namespace core
128 #if defined( BOOST_NO_STD_TYPEINFO )
130 typedef ::type_info typeinfo;
132 #else
134 typedef std::type_info typeinfo;
136 #endif
138 inline std::string demangled_name( core::typeinfo const & ti )
140 return core::demangle( ti.name() );
143 } // namespace core
145 } // namespace boost
147 #define BOOST_CORE_TYPEID(T) typeid(T)
149 #endif
151 #endif // #ifndef BOOST_CORE_TYPEINFO_HPP_INCLUDED