2
//===-------------------------- typeinfo ----------------------------------===//
4
// The LLVM Compiler Infrastructure
6
// This file is dual licensed under the MIT and the University of Illinois Open
7
// Source Licenses. See LICENSE.TXT for details.
9
//===----------------------------------------------------------------------===//
11
#ifndef __LIBCPP_TYPEINFO
12
#define __LIBCPP_TYPEINFO
25
bool operator==(const type_info& rhs) const noexcept;
26
bool operator!=(const type_info& rhs) const noexcept;
28
bool before(const type_info& rhs) const noexcept;
29
size_t hash_code() const noexcept;
30
const char* name() const noexcept;
32
type_info(const type_info& rhs) = delete;
33
type_info& operator=(const type_info& rhs) = delete;
41
bad_cast(const bad_cast&) noexcept;
42
bad_cast& operator=(const bad_cast&) noexcept;
43
virtual const char* what() const noexcept;
50
bad_typeid() noexcept;
51
bad_typeid(const bad_typeid&) noexcept;
52
bad_typeid& operator=(const bad_typeid&) noexcept;
53
virtual const char* what() const noexcept;
64
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
65
#pragma GCC system_header
68
namespace std // purposefully not using versioning namespace
71
class _LIBCPP_EXCEPTION_ABI type_info
73
type_info& operator=(const type_info&);
74
type_info(const type_info&);
76
const char* __type_name;
78
_LIBCPP_INLINE_VISIBILITY
79
explicit type_info(const char* __n)
85
_LIBCPP_INLINE_VISIBILITY
86
const char* name() const _NOEXCEPT {return __type_name;}
88
_LIBCPP_INLINE_VISIBILITY
89
bool before(const type_info& __arg) const _NOEXCEPT
90
{return __type_name < __arg.__type_name;}
91
_LIBCPP_INLINE_VISIBILITY
92
size_t hash_code() const _NOEXCEPT
93
{return *reinterpret_cast<const size_t*>(&__type_name);}
95
_LIBCPP_INLINE_VISIBILITY
96
bool operator==(const type_info& __arg) const _NOEXCEPT
97
{return __type_name == __arg.__type_name;}
98
_LIBCPP_INLINE_VISIBILITY
99
bool operator!=(const type_info& __arg) const _NOEXCEPT
100
{return !operator==(__arg);}
104
class _LIBCPP_EXCEPTION_ABI bad_cast
108
bad_cast() _NOEXCEPT;
109
virtual ~bad_cast() _NOEXCEPT;
110
virtual const char* what() const _NOEXCEPT;
113
class _LIBCPP_EXCEPTION_ABI bad_typeid
117
bad_typeid() _NOEXCEPT;
118
virtual ~bad_typeid() _NOEXCEPT;
119
virtual const char* what() const _NOEXCEPT;
124
#endif // __LIBCPP_TYPEINFO