W3cubDocs

/C++

operator==,!=,<,<=,>,>=,<=>(std::thread::id)

Defined in header <thread>
bool operator==( std::thread::id lhs, std::thread::id rhs ) noexcept;
(1) (since C++11)
bool operator!=( std::thread::id lhs, std::thread::id rhs ) noexcept;
(2) (since C++11)
(until C++20)
bool operator< ( std::thread::id lhs, std::thread::id rhs ) noexcept;
(3) (since C++11)
(until C++20)
bool operator<=( std::thread::id lhs, std::thread::id rhs ) noexcept;
(4) (since C++11)
(until C++20)
bool operator> ( std::thread::id lhs, std::thread::id rhs ) noexcept;
(5) (since C++11)
(until C++20)
bool operator>=( std::thread::id lhs, std::thread::id rhs ) noexcept;
(6) (since C++11)
(until C++20)
std::strong_ordering operator<=>( std::thread::id lhs,
                                  std::thread::id rhs ) noexcept;
(7) (since C++20)

Compares two thread identifiers.

1-2) Checks whether lhs and rhs represent either the same thread, or no thread.
3-7) Compares lhs and rhs in an unspecified total ordering.

The <, <=, >, >=, and != operators are synthesized from operator<=> and operator== respectively.

(since C++20)

Parameters

lhs, rhs - thread identifiers to compare

Return value

1-6) true if the corresponding relation holds, false otherwise.
7) std::strong_ordering::less if lhs is less than rhs in the total ordering; otherwise std::strong_ordering::greater if rhs is less than lhs in the total ordering; otherwise std::strong_ordering::equal.

Complexity

Constant.

See also

C documentation for thrd_equal

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/thread/thread/id/operator_cmp