fork(3) download
  1. #include <iostream>
  2. #include <future>
  3. using namespace std;
  4.  
  5. struct theClass {
  6.  
  7. void member() {
  8. std::async([]() {
  9. std::cout << "this: " << (void*)this;
  10. });
  11. }
  12.  
  13. };
  14.  
  15. int main() {
  16. theClass().member();
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 82816KB
stdin
Standard input is empty
compilation info
prog.cpp: In lambda function:
prog.cpp:9:36: error: ‘this’ was not captured for this lambda function
    std::cout << "this: " << (void*)this;
                                    ^~~~
stdout
Standard output is empty