@@ -26,11 +26,7 @@ class win32_thread_start_routine_tuple_allocate_guard
2626 {}
2727
2828 constexpr win32_thread_start_routine_tuple_allocate_guard (win32_thread_start_routine_tuple_allocate_guard const &) noexcept = delete;
29- constexpr win32_thread_start_routine_tuple_allocate_guard (win32_thread_start_routine_tuple_allocate_guard &&other) noexcept
30- : ptr_{other.ptr_ }
31- {
32- other.ptr_ = nullptr ;
33- }
29+ constexpr win32_thread_start_routine_tuple_allocate_guard (win32_thread_start_routine_tuple_allocate_guard &&other) noexcept = default;
3430
3531 constexpr ~win32_thread_start_routine_tuple_allocate_guard ()
3632 {
@@ -65,13 +61,11 @@ class win32_thread
6561 using native_handle_type = void *;
6662
6763private:
68- id id_;
69- native_handle_type handle_;
64+ id id_{} ;
65+ native_handle_type handle_{ nullptr } ;
7066
7167public:
72- win32_thread () noexcept
73- : id_{}, handle_{nullptr }
74- {}
68+ win32_thread () noexcept = default ;
7569
7670 template <typename Func, typename ... Args>
7771 requires (::std::invocable<Func, Args...>)
@@ -104,12 +98,7 @@ class win32_thread
10498
10599 constexpr win32_thread (win32_thread const &) noexcept = delete;
106100
107- constexpr win32_thread (win32_thread &&other) noexcept
108- : id_(other.id_), handle_(other.handle_)
109- {
110- other.id_ = 0 ;
111- other.handle_ = nullptr ;
112- }
101+ constexpr win32_thread (win32_thread &&other) noexcept = default;
113102
114103 constexpr ~win32_thread () noexcept
115104 {
@@ -142,7 +131,12 @@ class win32_thread
142131 return this ->id_ != 0 ;
143132 }
144133
145- constexpr void join ()
134+ #if __cpp_constexpr >= 202207L
135+ // https://en.cppreference.com/w/cpp/compiler_support/23.html#cpp_constexpr_202207L
136+ // for reduce some warning purpose
137+ constexpr
138+ #endif
139+ void join ()
146140 {
147141 if (!this ->joinable ()) [[unlikely]]
148142 {
@@ -152,7 +146,12 @@ class win32_thread
152146 this ->id_ = 0 ;
153147 }
154148
155- constexpr void detach ()
149+ #if __cpp_constexpr >= 202207L
150+ // https://en.cppreference.com/w/cpp/compiler_support/23.html#cpp_constexpr_202207L
151+ // for reduce some warning purpose
152+ constexpr
153+ #endif
154+ void detach ()
156155 {
157156 if (!this ->joinable ()) [[unlikely]]
158157 {
@@ -172,22 +171,26 @@ class win32_thread
172171 ::std::ranges::swap (id_, other.id_);
173172 }
174173
175- /* *
176- * @note Unlike std::thread::get_id, this method return the const reference.
177- */
178174 [[nodiscard]]
179- constexpr auto && get_id() const noexcept
175+ constexpr auto get_id () const noexcept
180176 {
181177 return this ->id_ ;
182178 }
183179
184180 [[nodiscard]]
185- constexpr auto && native_handle() const noexcept
181+ constexpr auto native_handle () const noexcept
186182 {
187183 return this ->handle_ ;
188184 }
189185
190- static constexpr ::std::uint_least32_t hardware_concurrency () noexcept
186+ [[nodiscard]]
187+ static
188+ #if __cpp_constexpr >= 202207L
189+ // https://en.cppreference.com/w/cpp/compiler_support/23.html#cpp_constexpr_202207L
190+ // for reduce some warning purpose
191+ constexpr
192+ #endif
193+ ::std::uint_least32_t hardware_concurrency () noexcept
191194 {
192195 ::fast_io::win32::system_info si{};
193196 ::fast_io::win32::GetSystemInfo (__builtin_addressof(si));
@@ -198,7 +201,13 @@ class win32_thread
198201namespace this_thread
199202{
200203
201- constexpr auto get_id () noexcept -> ::fast_io::win32::win32_thread::id
204+ [[nodiscard]]
205+ #if __cpp_constexpr >= 202207L
206+ // https://en.cppreference.com/w/cpp/compiler_support/23.html#cpp_constexpr_202207L
207+ // for reduce some warning purpose
208+ constexpr
209+ #endif
210+ auto get_id () noexcept -> ::fast_io::win32::win32_thread::id
202211{
203212 return ::fast_io::win32::GetCurrentThreadId ();
204213}
0 commit comments