18struct thread_id_access;
29 constexpr explicit thread_id(std::int64_t value) : value_(checked(value)) {}
36 [[nodiscard]]
static auto
40 return unexpected(std::make_error_code(std::errc::invalid_argument));
41 return thread_id(unchecked_tag{},
static_cast<std::uint64_t
>(value));
47 return lhs.value_ == rhs.value_;
57 return lhs.value_ < rhs.value_;
66 constexpr thread_id(unchecked_tag, std::uint64_t value) noexcept : value_(value) {}
68 [[nodiscard]]
static constexpr auto
69 checked(std::int64_t value) -> std::uint64_t
72 throw std::invalid_argument(
"thread_id must be positive");
73 return static_cast<std::uint64_t
>(value);
83 [[nodiscard]]
static constexpr auto
87 throw std::invalid_argument(
"thread_id must be positive");
90 [[nodiscard]]
static constexpr auto
static auto create(std::int64_t value) noexcept -> result< thread_id >
Construct a thread id without exceptions.
friend constexpr auto operator<(thread_id lhs, thread_id rhs) noexcept -> bool
friend constexpr auto operator!=(thread_id lhs, thread_id rhs) noexcept -> bool
constexpr thread_id(std::int64_t value)
Construct and validate a thread id.
friend constexpr auto operator==(thread_id lhs, thread_id rhs) noexcept -> bool
Error-returning result type used by the portable ThreadSchedule API.
auto operator()(threadschedule::thread_id value) const noexcept -> size_t
static constexpr auto value(thread_id id) noexcept -> std::uint64_t
static constexpr auto make(std::uint64_t value) -> thread_id