Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/__cxx03/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___CXX03_TYPEINDEX
0011 #define _LIBCPP___CXX03_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 #include <__cxx03/__config>
0049 #include <__cxx03/__functional/unary_function.h>
0050 #include <__cxx03/typeinfo>
0051 #include <__cxx03/version>
0052 
0053 // standard-mandated includes
0054 #include <__cxx03/compare>
0055 
0056 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0057 #  pragma GCC system_header
0058 #endif
0059 
0060 _LIBCPP_BEGIN_NAMESPACE_STD
0061 
0062 class _LIBCPP_TEMPLATE_VIS type_index {
0063   const type_info* __t_;
0064 
0065 public:
0066   _LIBCPP_HIDE_FROM_ABI type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
0067 
0068   _LIBCPP_HIDE_FROM_ABI bool operator==(const type_index& __y) const _NOEXCEPT { return *__t_ == *__y.__t_; }
0069 #if _LIBCPP_STD_VER <= 17
0070   _LIBCPP_HIDE_FROM_ABI bool operator!=(const type_index& __y) const _NOEXCEPT { return *__t_ != *__y.__t_; }
0071 #endif
0072   _LIBCPP_HIDE_FROM_ABI bool operator<(const type_index& __y) const _NOEXCEPT { return __t_->before(*__y.__t_); }
0073   _LIBCPP_HIDE_FROM_ABI bool operator<=(const type_index& __y) const _NOEXCEPT { return !__y.__t_->before(*__t_); }
0074   _LIBCPP_HIDE_FROM_ABI bool operator>(const type_index& __y) const _NOEXCEPT { return __y.__t_->before(*__t_); }
0075   _LIBCPP_HIDE_FROM_ABI bool operator>=(const type_index& __y) const _NOEXCEPT { return !__t_->before(*__y.__t_); }
0076 #if _LIBCPP_STD_VER >= 20
0077   _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const type_index& __y) const noexcept {
0078     if (*__t_ == *__y.__t_)
0079       return strong_ordering::equal;
0080     if (__t_->before(*__y.__t_))
0081       return strong_ordering::less;
0082     return strong_ordering::greater;
0083   }
0084 #endif
0085 
0086   _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __t_->hash_code(); }
0087   _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT { return __t_->name(); }
0088 };
0089 
0090 template <class _Tp>
0091 struct _LIBCPP_TEMPLATE_VIS hash;
0092 
0093 template <>
0094 struct _LIBCPP_TEMPLATE_VIS hash<type_index> : public __unary_function<type_index, size_t> {
0095   _LIBCPP_HIDE_FROM_ABI size_t operator()(type_index __index) const _NOEXCEPT { return __index.hash_code(); }
0096 };
0097 
0098 _LIBCPP_END_NAMESPACE_STD
0099 
0100 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0101 #  include <__cxx03/iosfwd>
0102 #  include <__cxx03/new>
0103 #  include <__cxx03/utility>
0104 #endif
0105 
0106 #endif // _LIBCPP___CXX03_TYPEINDEX