Use same style for optional and avoid double check

I did not know that `std::optional::value()` did checked access. And I
still prefer a more explicit .has_value() over boolean conversion, but
this seems to be the accepted way to do this.
This commit is contained in:
Robbert van der Helm
2020-06-05 22:27:04 +02:00
parent ff298f3f46
commit 33777d2876
7 changed files with 35 additions and 36 deletions
+2 -2
View File
@@ -26,8 +26,8 @@ Win32Timer::Win32Timer(HWND window_handle,
}
Win32Timer::~Win32Timer() {
if (timer_id.has_value()) {
KillTimer(window_handle, timer_id.value());
if (timer_id) {
KillTimer(window_handle, *timer_id);
}
}