Warning, /include/c++/v1/typeindex is written in an unsupported language. File is not indexed.
0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009
0010 #ifndef _LIBCPP_TYPEINDEX
0011 #define _LIBCPP_TYPEINDEX
0012
0013 /*
0014
0015 typeindex synopsis
0016
0017 namespace std
0018 {
0019
0020 class type_index
0021 {
0022 public:
0023 type_index(const type_info& rhs) noexcept;
0024
0025 bool operator==(const type_index& rhs) const noexcept;
0026 bool operator!=(const type_index& rhs) const noexcept; // removed in C++20
0027 bool operator< (const type_index& rhs) const noexcept;
0028 bool operator<=(const type_index& rhs) const noexcept;
0029 bool operator> (const type_index& rhs) const noexcept;
0030 bool operator>=(const type_index& rhs) const noexcept;
0031 strong_ordering operator<=>(const type_index& rhs) const noexcept; // C++20
0032
0033 size_t hash_code() const noexcept;
0034 const char* name() const noexcept;
0035 };
0036
0037 template <>
0038 struct hash<type_index>
0039 : public unary_function<type_index, size_t>
0040 {
0041 size_t operator()(type_index index) const noexcept;
0042 };
0043
0044 } // std
0045
0046 */
0047
0048 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0049 # include <__cxx03/typeindex>
0050 #else
0051 # include <__config>
0052 # include <__functional/unary_function.h>
0053 # include <typeinfo>
0054 # include <version>
0055
0056 // standard-mandated includes
0057 # include <compare>
0058
0059 # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0060 # pragma GCC system_header
0061 # endif
0062
0063 _LIBCPP_BEGIN_NAMESPACE_STD
0064
0065 class _LIBCPP_TEMPLATE_VIS type_index {
0066 const type_info* __t_;
0067
0068 public:
0069 _LIBCPP_HIDE_FROM_ABI type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
0070
0071 _LIBCPP_HIDE_FROM_ABI bool operator==(const type_index& __y) const _NOEXCEPT { return *__t_ == *__y.__t_; }
0072 # if _LIBCPP_STD_VER <= 17
0073 _LIBCPP_HIDE_FROM_ABI bool operator!=(const type_index& __y) const _NOEXCEPT { return *__t_ != *__y.__t_; }
0074 # endif
0075 _LIBCPP_HIDE_FROM_ABI bool operator<(const type_index& __y) const _NOEXCEPT { return __t_->before(*__y.__t_); }
0076 _LIBCPP_HIDE_FROM_ABI bool operator<=(const type_index& __y) const _NOEXCEPT { return !__y.__t_->before(*__t_); }
0077 _LIBCPP_HIDE_FROM_ABI bool operator>(const type_index& __y) const _NOEXCEPT { return __y.__t_->before(*__t_); }
0078 _LIBCPP_HIDE_FROM_ABI bool operator>=(const type_index& __y) const _NOEXCEPT { return !__t_->before(*__y.__t_); }
0079 # if _LIBCPP_STD_VER >= 20
0080 _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const type_index& __y) const noexcept {
0081 if (*__t_ == *__y.__t_)
0082 return strong_ordering::equal;
0083 if (__t_->before(*__y.__t_))
0084 return strong_ordering::less;
0085 return strong_ordering::greater;
0086 }
0087 # endif
0088
0089 _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __t_->hash_code(); }
0090 _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT { return __t_->name(); }
0091 };
0092
0093 template <class _Tp>
0094 struct _LIBCPP_TEMPLATE_VIS hash;
0095
0096 template <>
0097 struct _LIBCPP_TEMPLATE_VIS hash<type_index> : public __unary_function<type_index, size_t> {
0098 _LIBCPP_HIDE_FROM_ABI size_t operator()(type_index __index) const _NOEXCEPT { return __index.hash_code(); }
0099 };
0100
0101 _LIBCPP_END_NAMESPACE_STD
0102
0103 # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0104 # include <cstddef>
0105 # include <iosfwd>
0106 # include <new>
0107 # include <utility>
0108 # endif
0109 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0110
0111 #endif // _LIBCPP_TYPEINDEX