online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <functional> #include <iostream> struct worker { std::function<bool(std::string)> m_callback; void do_work(std::function<bool(std::string)> callback) { //m_callback = std::bind(callback, std::placeholders::_1); m_callback = [&](std::string data){ callback(data); }; std::cout << "worker is working..." << std::endl; callback("worker is complete"); } }; // pretty boring class - a cut down of my actual class struct helper { bool work_callback(std::string str) { std::cout << "Helper: msg from worker: " << str << std::endl; return false; } }; int main() { helper the_helper; worker the_worker; std::cout << "Main: start\n"; the_worker.do_work([&](std::string data){ return the_helper.work_callback(data); }); std::cout << "Main: end\n\n"; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue