#include <iostream> #include <future> using namespace std; struct theClass { void member() { std::async([]() { std::cout << "this: " << (void*)this; }); } }; int main() { theClass().member(); return 0; }
Standard input is empty
prog.cpp: In lambda function:
prog.cpp:9:36: error: ‘this’ was not captured for this lambda function
std::cout << "this: " << (void*)this;
^~~~
Standard output is empty