std::type_index:: operator==,!=,<,<=,>,>=,<=>
From cppreference.net
<
cpp
|
types
|
type index
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Type support
| Basic types | |||||||||||||||||||||
| Fixed width integer types (C++11) | |||||||||||||||||||||
| Fixed width floating-point types (C++23) | |||||||||||||||||||||
|
|||||||||||||||||||||
| Numeric limits | |||||||||||||||||||||
| C numeric limits interface | |||||||||||||||||||||
| Runtime type information | |||||||||||||||||||||
|
|||||||||||||||||||||
std::type_index
| Member functions | ||||
|
type_index::operator=
type_index::operator!=
type_index::operator<
type_index::operator<=
type_index::operator>
type_index::operator>=
type_index::operator<=>
(until C++20)
(C++20)
|
||||
| Helper classes | ||||
|
(C++11)
|
|
bool
operator
==
(
const
type_index
&
rhs
)
const
noexcept
;
|
(1) | (自 C++11 起) |
|
bool
operator
!
=
(
const
type_index
&
rhs
)
const
noexcept
;
|
(2) |
(自 C++11 起)
(直至 C++20) |
|
bool
operator
<
(
const
type_index
&
rhs
)
const
noexcept
;
|
(3) | (自 C++11 起) |
|
bool
operator
<=
(
const
type_index
&
rhs
)
const
noexcept
;
|
(4) | (自 C++11 起) |
|
bool
operator
>
(
const
type_index
&
rhs
)
const
noexcept
;
|
(5) | (自 C++11 起) |
|
bool
operator
>=
(
const
type_index
&
rhs
)
const
noexcept
;
|
(6) | (自 C++11 起) |
|
std::
strong_ordering
operator
<=>
(
const
type_index
&
rhs
)
const
noexcept
;
|
(7) | (自 C++20 起) |
比较底层的 std::type_info 对象。
1,2)
检查底层的
std::type_info
对象是否引用同一类型。
|
|
(C++20 起) |
参数
| rhs | - |
用于比较的另一个
type_index
对象
|
返回值
7)
std
::
strong_ordering
::
equal
若底层
std::type_info
对象指向相同类型,否则为
std
::
strong_ordering
::
less
若
*
this
的底层
std::type_info
对象在实现定义的排序中先于
rhs
的底层对象,否则为
std
::
strong_ordering
::
greater
。