online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include<future> #include<iostream> #include<array> #include<algorithm> std::array<int, 100> arr; int sum=0; struct Wrapper { void consume() { std::cout << std::this_thread::get_id() << std::endl; std::for_each(arr.begin(), arr.end(), [](int val) {sum+=val; }); std::cout << sum << std::endl; } bool produce() { std::cout << std::this_thread::get_id() << std::endl; auto temp = { 1,0,3 }; return true; } }; int main() { std::fill(arr.begin(), arr.end(), 1); std::cout << std::this_thread::get_id() << std::endl; Wrapper wrap; std::future<bool> fut = std::async(std::launch::async, &Wrapper::produce, &wrap); if (fut.get()) std::async(std::launch::async, &Wrapper::consume, &wrap).get(); }

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