std::thread and rvalue reference
问题 I wanted to have some kind of delegator class. Shortened version of my approach is below and it's main functionality is to start new thread doing some thing (in this example it prints text every second): void Flusher::start(){ m_continue.store(true); m_thread = std::thread([](std::atomic<bool>& shouldContinue){ while(shouldContinue.load()){ std::this_thread::sleep_for(std::chrono::seconds(1)); std::cout << "sec passed" << std::endl; }}, std::ref<std::atomic<bool>>(m_continue) ); } My concern