38 [[nodiscard]]
static auto
41 if (value < minimum || value >
maximum)
42 return unexpected(std::make_error_code(std::errc::invalid_argument));
47 [[nodiscard]]
constexpr auto
56 return lhs.value_ == rhs.value_;
68 constexpr realtime_priority(unchecked_tag,
int value) noexcept : value_(
value) {}
70 [[nodiscard]]
static constexpr auto
71 checked(
int value) ->
int
73 if (value < minimum || value >
maximum)
74 throw std::invalid_argument(
"realtime_priority must be in the range 1..99");
Strongly-typed realtime priority in the range $[1, 99]$.
friend constexpr auto operator!=(realtime_priority lhs, realtime_priority rhs) noexcept -> bool
constexpr auto value() const noexcept -> int
Return the wrapped realtime priority value.
constexpr realtime_priority(int value)
Construct and validate a realtime priority.
static constexpr int maximum
Highest accepted realtime priority value.
friend constexpr auto operator==(realtime_priority lhs, realtime_priority rhs) noexcept -> bool
static auto create(int value) noexcept -> result< realtime_priority >
Construct a realtime priority without exceptions.
static constexpr int minimum
Lowest accepted realtime priority value.
Error-returning result type used by the portable ThreadSchedule API.