Namespaces
Variants
Views
Actions

std::type_index::operator==,!=,<,<=,>,>=,<=>

From cppreference.com
< cpp‎ | types‎ | type index
 
 
Utilities library
Language support
Type support (basic types, RTTI)
Library feature-test macros (C++20)
Dynamic memory management
Program utilities
Coroutine support (C++20)
Variadic functions
Debugging support
(C++26)
Three-way comparison
(C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
Elementary string conversions
(C++17)
(C++17)

 
 
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
 
bool operator==( const type_index& rhs ) const noexcept;
(1) (since C++11)
bool operator!=( const type_index& rhs ) const noexcept;
(2) (since C++11)
(until C++20)
bool operator<( const type_index& rhs ) const noexcept;
(3) (since C++11)
bool operator<=( const type_index& rhs ) const noexcept;
(4) (since C++11)
bool operator>( const type_index& rhs ) const noexcept;
(5) (since C++11)
bool operator>=( const type_index& rhs ) const noexcept;
(6) (since C++11)
std::strong_ordering operator<=>( const type_index& rhs ) const noexcept;
(7) (since C++20)

Compares the underlying std::type_info objects.

1,2) Checks whether the underlying std::type_info objects refer to the same type.
3-7) Compares the underlying std::type_info objects as defined by an implementation-defined ordering. The comparison is done by type_info::before.

The != operator is synthesized from operator==.

(since C++20)

[edit] Parameters

rhs - another type_index object to compare to

[edit] Return value

1) true if the underlying std::type_info objects refer to the same type, false otherwise.
2) true if the underlying std::type_info objects refer not to the same type, false otherwise.
3-6) true if the types referred by the underlying std::type_info objects are ordered by corresponding order, false otherwise.
7) std::strong_ordering::equal if the underlying std::type_info objects refer to the same type, otherwise std::strong_ordering::less if *this's underlying std::type_info object precedes rhs's in the implementation-defined ordering, otherwise std::strong_ordering::greater.