You can initialize the capture directly and rely on C++17 guaranteed copy/move elision:
#include <atomic>int main(){ auto check = [a = std::atomic_int(42)]() mutable { return a.fetch_sub(1) == 1; };}
You can initialize the capture directly and rely on C++17 guaranteed copy/move elision:
#include <atomic>int main(){ auto check = [a = std::atomic_int(42)]() mutable { return a.fetch_sub(1) == 1; };}