32 #pragma GCC system_header
35 #if __cplusplus >= 201103L
39 #pragma GCC visibility push(default)
41 #if __cplusplus >= 202100L
42 # define __cpp_lib_constexpr_typeinfo 202106L
49 class __class_type_info;
70 #ifndef __GXX_MERGED_TYPEINFO_NAMES
72 #define __GXX_MERGED_TYPEINFO_NAMES 0
76 #ifndef __GXX_TYPEINFO_EQUALITY_INLINE
78 #define __GXX_TYPEINFO_EQUALITY_INLINE 0
80 #define __GXX_TYPEINFO_EQUALITY_INLINE 1
103 const char*
name() const _GLIBCXX_NOEXCEPT
104 {
return __name[0] ==
'*' ? __name + 1 : __name; }
111 bool operator==(
const type_info& __arg)
const _GLIBCXX_NOEXCEPT;
113 #if __cpp_impl_three_way_comparison < 201907L
114 bool operator!=(
const type_info& __arg)
const _GLIBCXX_NOEXCEPT
115 {
return !operator==(__arg); }
118 #if __cplusplus >= 201103L
119 size_t hash_code() const noexcept
121 # if !__GXX_MERGED_TYPEINFO_NAMES
122 return _Hash_bytes(
name(), __builtin_strlen(
name()),
123 static_cast<size_t>(0xc70f6907UL));
125 return reinterpret_cast<size_t>(__name);
131 virtual bool __is_pointer_p()
const;
134 virtual bool __is_function_p()
const;
142 virtual bool __do_catch(
const type_info *__thr_type,
void **__thr_obj,
143 unsigned __outer)
const;
146 virtual bool __do_upcast(
const __cxxabiv1::__class_type_info *__target,
147 void **__obj_ptr)
const;
152 explicit type_info(
const char *__n): __name(__n) { }
156 #if __cplusplus >= 201103L
157 type_info& operator=(
const type_info&) =
delete;
158 type_info(
const type_info&) =
delete;
160 type_info& operator=(
const type_info&);
161 type_info(
const type_info&);
164 #if ! __GXX_TYPEINFO_EQUALITY_INLINE
165 bool __equal(
const type_info&)
const _GLIBCXX_NOEXCEPT;
169 #if __GXX_TYPEINFO_EQUALITY_INLINE
173 #if !__GXX_MERGED_TYPEINFO_NAMES
177 if (__name[0] !=
'*' || __arg.__name[0] !=
'*')
178 return __builtin_strcmp (__name, __arg.__name) < 0;
187 return __name < __arg.__name;
191 #if __GXX_TYPEINFO_EQUALITY_INLINE || __cplusplus > 202002L
192 _GLIBCXX23_CONSTEXPR
inline bool
193 type_info::operator==(
const type_info& __arg)
const _GLIBCXX_NOEXCEPT
195 if (std::__is_constant_evaluated())
196 return this == &__arg;
198 if (__name == __arg.__name)
201 #if !__GXX_TYPEINFO_EQUALITY_INLINE
203 return __equal(__arg);
204 #elif !__GXX_MERGED_TYPEINFO_NAMES
206 return __name[0] !=
'*' && __builtin_strcmp (__name, __arg.name()) == 0;
223 bad_cast() _GLIBCXX_USE_NOEXCEPT { }
227 virtual ~
bad_cast() _GLIBCXX_USE_NOEXCEPT;
230 virtual const char*
what() const _GLIBCXX_USE_NOEXCEPT;
247 virtual const char*
what() const _GLIBCXX_USE_NOEXCEPT;
253 #pragma GCC visibility pop
ISO C++ entities toplevel namespace is std.
bool before(const type_info &__arg) const noexcept
const char * name() const noexcept
Thrown during incorrect typecasting.
virtual const char * what() const noexcept
Thrown when a NULL pointer in a typeid expression is used.
virtual const char * what() const noexcept
Base class for all library exceptions.