Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      operator==,!=,<,<=,>,>=,<=>(std::chrono::time_point)

      From cppreference.com
      <cpp‎ |chrono‎ |time point
       
       
      Date and time library
       
       
      Defined in header<chrono>
      (1)
      template<class Clock,class Dur1,class Dur2>

      bool operator==(conststd::chrono::time_point<Clock,Dur1>& lhs,

                       conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++11)
      (until C++14)
      template<class Clock,class Dur1,class Dur2>

      constexprbool operator==(conststd::chrono::time_point<Clock,Dur1>& lhs,

                                 conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++14)
      (2)
      template<class Clock,class Dur1,class Dur2>

      bool operator!=(conststd::chrono::time_point<Clock,Dur1>& lhs,

                       conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++11)
      (until C++14)
      template<class Clock,class Dur1,class Dur2>

      constexprbool operator!=(conststd::chrono::time_point<Clock,Dur1>& lhs,

                                 conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++14)
      (until C++20)
      (3)
      template<class Clock,class Dur1,class Dur2>

      bool operator<(conststd::chrono::time_point<Clock,Dur1>& lhs,

                     conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++11)
      (until C++14)
      template<class Clock,class Dur1,class Dur2>

      constexprbool operator<(conststd::chrono::time_point<Clock,Dur1>& lhs,

                               conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++14)
      (4)
      template<class Clock,class Dur1,class Dur2>

      bool operator<=(conststd::chrono::time_point<Clock,Dur1>& lhs,

                       conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++11)
      (until C++14)
      template<class Clock,class Dur1,class Dur2>

      constexprbool operator<=(conststd::chrono::time_point<Clock,Dur1>& lhs,

                                 conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++14)
      (5)
      template<class Clock,class Dur1,class Dur2>

      bool operator>(conststd::chrono::time_point<Clock,Dur1>& lhs,

                     conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++11)
      (until C++14)
      template<class Clock,class Dur1,class Dur2>

      constexprbool operator>(conststd::chrono::time_point<Clock,Dur1>& lhs,

                               conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++14)
      (6)
      template<class Clock,class Dur1,class Dur2>

      bool operator>=(conststd::chrono::time_point<Clock,Dur1>& lhs,

                       conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++11)
      (until C++14)
      template<class Clock,class Dur1,class Dur2>

      constexprbool operator>=(conststd::chrono::time_point<Clock,Dur1>& lhs,

                                 conststd::chrono::time_point<Clock,Dur2>& rhs);
      (since C++14)
      template<class Clock,class Dur1,std::three_way_comparable_with<Dur1> Dur2>

      constexprauto operator<=>(conststd::chrono::time_point<Clock,Dur1>& lhs,

                                 conststd::chrono::time_point<Clock,Dur2>& rhs);
      (7)(since C++20)

      Compares two time points. The comparison is done by comparing the resultstime_since_epoch() for the time points.

      1,2) Checks if the time pointslhs andrhs refer to the same time point for the given clock.
      3-6) Compares the time pointslhs andrhs.
      7) Compares the time pointslhs andrhs. The return type is deduced fromlhs.time_since_epoch()<=> rhs.time_since_epoch(), and hence the three-way comparison result type ofDur1 andDur2.

      The!= operator issynthesized fromoperator==.

      (since C++20)

      Contents

      [edit]Parameters

      lhs, rhs - time points to compare

      [edit]Return value

      1)true if thelhs andrhs refer to the same time point,false otherwise.
      2)true if thelhs andrhs refer to different time points,false otherwise.
      3)true if thelhs refers to time pointbeforerhs,false otherwise.
      4)true if thelhs refers to time pointbeforerhs, or to the same time point asrhs,false otherwise.
      5)true if thelhs refers to time pointafterrhs,false otherwise.
      6)true if thelhs refers to time pointafterrhs, or to the same time point asrhs,false otherwise.
      7)lhs.time_since_epoch()<=> rhs.time_since_epoch().

      [edit]Exceptions

      May throw implementation-defined exceptions.

      [edit]Notes

      Two-way comparison operators oftime_point were notconstexpr in C++11, this was corrected in C++14.

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/chrono/time_point/operator_cmp&oldid=157508"

      [8]ページ先頭

      ©2009-2026 Movatter.jp