struct Bar { void bar() {} }; struct Foo { void foo(Bar& b){ b.bar(); } }; #include <thread> int main() { Foo f; Bar b; std::thread t(&Foo::foo, &f, std::ref(b)); t.join(); }
Standard input is empty
Standard output is empty
terminate called after throwing an instance of 'std::system_error' what(): Enable multithreading to use std::thread: Operation not permitted