42#ifdef __cpp_lib_jthread
48 bool stop_requested()
const {
return false; }
54 bool request_stop()
noexcept {
return false; }
55 bool stop_requested()
const noexcept {
return false; }
61 template<
typename F,
typename... Args>
62 explicit jthread(F&& f, Args&&... args)
63 : std::thread([](std::decay_t<F> f, std::decay_t<Args>... args) {
64 if constexpr (std::is_invocable_v<std::decay_t<F>,
stop_token, std::decay_t<Args>...>) {
67 f(std::move(args)...);
69 }, std::forward<F>(f), std::forward<Args>(args)...) {}
72 if (joinable()) join();
73 std::thread::operator=(std::move(other));
77 if (joinable()) join();
79 void request_stop()
noexcept {}
86#if defined(__cpp_lib_ranges_contains) && __cpp_lib_ranges_contains >= 202207L
87 using std::ranges::contains;
89 template<
typename R,
typename T>
90 constexpr bool contains(R&& r,
const T& value) {
91 return std::ranges::find(r, value) != std::ranges::end(r);