37 [[nodiscard]]
static auto
41 return unexpected(std::make_error_code(std::errc::invalid_argument));
42 return cpu_id(unchecked_tag{},
static_cast<std::uint32_t
>(
value));
46 [[nodiscard]]
constexpr auto
55 return lhs.value_ == rhs.value_;
65 return lhs.value_ < rhs.value_;
73 constexpr cpu_id(unchecked_tag, std::uint32_t
value) noexcept : value_(
value) {}
75 [[nodiscard]]
static constexpr auto
76 checked(
int value) -> std::uint32_t
79 throw std::invalid_argument(
"cpu_id must not be negative");
80 return static_cast<std::uint32_t
>(
value);
Validated CPU identifier.
static auto create(int value) noexcept -> result< cpu_id >
Construct a CPU id without exceptions.
friend constexpr auto operator<(cpu_id lhs, cpu_id rhs) noexcept -> bool
friend constexpr auto operator!=(cpu_id lhs, cpu_id rhs) noexcept -> bool
constexpr cpu_id(int value)
Construct a CPU id and throw on invalid input.
friend constexpr auto operator==(cpu_id lhs, cpu_id rhs) noexcept -> bool
constexpr auto value() const noexcept -> std::uint32_t
Return the underlying CPU index.
Error-returning result type used by the portable ThreadSchedule API.