scheduler: Capture ‘this’ explicitly in lambda

Without the changes, g++ will warn to compile under C++20:

scheduler.cpp:114:21: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
  114 |     scheduleFromNow([=] { Repeat(*this, f, delta); }, delta);
      |                     ^
scheduler.cpp:114:21: note: add explicit ‘this’ or ‘*this’ capture
24.x
MarcoFalke 3 years ago
parent 98e9d8e8e2
commit fae2220f4e
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -111,7 +111,7 @@ static void Repeat(CScheduler& s, CScheduler::Function f, std::chrono::milliseco
void CScheduler::scheduleEvery(CScheduler::Function f, std::chrono::milliseconds delta)
{
scheduleFromNow([=] { Repeat(*this, f, delta); }, delta);
scheduleFromNow([this, f, delta] { Repeat(*this, f, delta); }, delta);
}
size_t CScheduler::getQueueInfo(std::chrono::system_clock::time_point& first,

Loading…
Cancel
Save