Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::type_info::before

      From cppreference.com
      <cpp‎ |types‎ |type info
       
       
      Utilities library
       
       
       
      bool before(const type_info& rhs)const;
      (noexcept since C++11)

      Returnstrue if the type of thistype_info precedes the type ofrhs in the implementation's collation order. No guarantees are given; in particular, the collation order can change between the invocations of the same program.

      Contents

      [edit]Parameters

      rhs - another type information object to compare to

      [edit]Return value

      true if the type of thistype_info precedes the type ofrhs in the implementation's collation order.

      [edit]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";elsestd::cout<<"char goes before int in this implementation.\n";}

      Possible output:

      char goes before int in this implementation.

      [edit]See also

      (removed in C++20)
      checks whether the objects refer to the same type
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/types/type_info/before&oldid=175773"

      [8]ページ先頭

      ©2009-2025 Movatter.jp