#include <iostream> class Test {public: Test(){} typedef bool(*Fun)(); Fun F() { return [=]()->bool {return this->Show(); };//invalid...Orz } bool Show() { std::cout << "seikou!" << std::endl; }}; int main() { Test T; auto f = T.F(); f(); return 0;}
Standard input is empty
prog.cpp: In member function ‘bool (* Test::F())()’: prog.cpp:10:44: error: cannot convert ‘Test::F()::<lambda()>’ to ‘Test::Fun {aka bool (*)()}’ in return return [=]()->bool {return this->Show(); };//invalid...Orz ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!