1//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
2
3//Distributed under the Boost Software License, Version 1.0. (See accompanying
4//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef BOOST_EXCEPTION_C3E1741C754311DDB2834CCA55D89593
7#define BOOST_EXCEPTION_C3E1741C754311DDB2834CCA55D89593
8
9#include <boost/config.hpp>
10#include <boost/core/typeinfo.hpp>
11#include <boost/core/demangle.hpp>
12#include <boost/current_function.hpp>
13#include <string>
14
15#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS
16#if __GNUC__*100+__GNUC_MINOR__>301
17#pragma GCC system_header
18#endif
19#ifdef __clang__
20#pragma clang system_header
21#endif
22#ifdef _MSC_VER
23#pragma warning(push,1)
24#endif
25#endif
26
27namespace
28boost
29 {
30 template <class T>
31 inline
32 std::string
33 tag_type_name()
34 {
35#ifdef BOOST_NO_TYPEID
36 return BOOST_CURRENT_FUNCTION;
37#else
38 return core::demangle(name: typeid(T*).name());
39#endif
40 }
41
42 template <class T>
43 inline
44 std::string
45 type_name()
46 {
47#ifdef BOOST_NO_TYPEID
48 return BOOST_CURRENT_FUNCTION;
49#else
50 return core::demangle(name: typeid(T).name());
51#endif
52 }
53
54 namespace
55 exception_detail
56 {
57 struct
58 type_info_
59 {
60 core::typeinfo const * type_;
61
62 explicit
63 type_info_( core::typeinfo const & type ):
64 type_(&type)
65 {
66 }
67
68 friend
69 bool
70 operator<( type_info_ const & a, type_info_ const & b )
71 {
72 return 0!=(a.type_->before(arg: *b.type_));
73 }
74 };
75 }
76 }
77
78#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_CORE_TYPEID(T))
79
80#ifndef BOOST_NO_RTTI
81#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
82#endif
83
84#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
85#pragma warning(pop)
86#endif
87#endif
88

source code of include/boost/exception/detail/type_info.hpp