std::type_info::before(3)
π std::type_info::before
okay so this is the C++ Standard Library page (the original header says βC++ Standard Libaryβ β a typo icon, we stan π) for std::type_info::before, and bestie, itβs giving short-but-iconic energy. π¦
πΈ NAME
std::type_info::before β literally std::type_info::before. Thatβs the whole name, no plot twist. π
β¨ Synopsis
bool before( const type_info& rhs ) const; (until C++11)
bool before( const type_info& rhs ) const noexcept; (since C++11)
Returns true if the type of this type_info precedes the type of rhs in the implementationβs collation order. No guarantees are given β none, zero, zilch β and in particular, the collation order can change between invocations of the same program. π Thatβs the tea: itβs implementation-defined behavior, not a promise. π
π Parameters
rhsβ another type information object to compare to. Basically the othertype_infobestie in the comparison. π«Ά
π Return value
true if the type of this type_info precedes the type of rhs in the implementationβs collation order. β¨
π Example
// Run this code
#include <iostream>
#include <typeinfo>
int main()
{
if (typeid(int).before(typeid(char)))
std::cout << "int goes before char in this implementation.\n";
else
std::cout << "char goes before int in this implementation.\n";
}
π« Possible output
char goes before int in this implementation.
π See also
operator==β checks whether the objects refer to the same type. π―ββοΈoperator!=β also a public member function, and itβs removed in C++20. π
π Source:http://cppreference.comΒ· version/date:2024.06.10Β· page:std::type_info::before(3). Bye bestie, go get that collation order! π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms