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 nice_value(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(
"nice_value must be in the range -20..19");
Strongly-typed nice value in the POSIX range $[-20, 19]$.
static constexpr int minimum
Lowest accepted nice value (highest priority).
friend constexpr auto operator!=(nice_value lhs, nice_value rhs) noexcept -> bool
constexpr auto value() const noexcept -> int
Return the wrapped nice value.
friend constexpr auto operator==(nice_value lhs, nice_value rhs) noexcept -> bool
constexpr nice_value(int value)
Construct and validate a nice value.
static auto create(int value) noexcept -> result< nice_value >
Construct a nice value without exceptions.
static constexpr int maximum
Highest accepted nice value (lowest priority).
Error-returning result type used by the portable ThreadSchedule API.