Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _GLIBCXX_TYPEINDEX
00030 #define _GLIBCXX_TYPEINDEX 1
00031
00032 #pragma GCC system_header
00033
00034 #ifndef __GXX_EXPERIMENTAL_CXX0X__
00035 # include <bits/c++0x_warning.h>
00036 #else
00037
00038 #include <typeinfo>
00039
00040 namespace std _GLIBCXX_VISIBILITY(default)
00041 {
00042 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00043
00044
00045
00046
00047
00048
00049 struct type_index
00050 {
00051 type_index(const type_info& __rhs)
00052 : _M_target(&__rhs) { }
00053
00054 bool
00055 operator==(const type_index& __rhs) const
00056 { return *_M_target == *__rhs._M_target; }
00057
00058 bool
00059 operator!=(const type_index& __rhs) const
00060 { return *_M_target != *__rhs._M_target; }
00061
00062 bool
00063 operator<(const type_index& __rhs) const
00064 { return _M_target->before(*__rhs._M_target); }
00065
00066 bool
00067 operator<=(const type_index& __rhs) const
00068 { return !__rhs._M_target->before(*_M_target); }
00069
00070 bool
00071 operator>(const type_index& __rhs) const
00072 { return __rhs._M_target->before(*_M_target); }
00073
00074 bool
00075 operator>=(const type_index& __rhs) const
00076 { return !_M_target->before(*__rhs._M_target); }
00077
00078 size_t
00079 hash_code() const
00080 { return _M_target->hash_code(); }
00081
00082 const char*
00083 name() const
00084 { return _M_target->name(); }
00085
00086 private:
00087 const type_info* _M_target;
00088 };
00089
00090 template<typename _Tp> struct hash;
00091
00092
00093 template<>
00094 struct hash<type_index>
00095 {
00096 typedef size_t result_type;
00097 typedef type_index argument_type;
00098
00099 size_t
00100 operator()(const type_index& __ti) const
00101 { return __ti.hash_code(); }
00102 };
00103
00104 _GLIBCXX_END_NAMESPACE_VERSION
00105 }
00106
00107 #endif // __GXX_EXPERIMENTAL_CXX0X__
00108
00109 #endif // _GLIBCXX_TYPEINDEX