std::type_i...or==,!=,,>=,(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay so bestie, welcome to the std::type_i...or==,!=,,>=,(3) manual page from the C++ Standard Libary β€” yes, β€œLibary” is literally how the header spells it, not me πŸ’€. The NAME section is giving β€œsomeone sat on the keyboard,” but we keep it exact:

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

✨ Synopsis ✨

These are the comparison operators for std::type_index, and no cap, every single one is const noexcept β€” we love a low-drama signature 🫢. The numbers and the since / until notes are preserved exactly:

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
(7) (since C++20)
noexcept;

Then the actual tea: it 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.

Also important icon behavior: the != operator is synthesized from operator==. (since C++20)


πŸŽ€ Parameters πŸŽ€

  • rhs β€” another type_index object to compare to

🌈 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.

periodt πŸ’…


mwah πŸ’‹ this page came from http://cppreference.com, stamped 2024.06.10, and filed under std::type_i...or==,!=,,>=,(3). go off bestie 🫢✨

πŸ“¦ where this page comes from