std::type_index::operator==,!=,<,<=,>,>=,<=>
來自 cppreference.com
< cpp | 型別 | type_index
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::type_info 物件指代同一型別,則為 std::strong_ordering::equal,否則如果 *this 的底層 std::type_info 物件在實現定義的排序中先於 rhs 的,則為 std::strong_ordering::less,否則為 std::strong_ordering::greater。