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 <iostream> #include <memory> #include <queue> using namespace std; class MyObject { public: struct Packet { uint8_t message; uint8_t index; }; void pushToQueue(void); void FrontOfQueue(std::unique_ptr<Packet> *inputFrame); private: std::queue<std::unique_ptr<Packet>> PacketQueue; }; void MyObject::pushToQueue(void) { Packet frame; static int counter = 1; frame.message = counter; frame.index =counter; counter++; std::unique_ptr<Packet> passthru_ptr = std::make_unique<Packet>(std::move(frame)); PacketQueue.push(std::move(passthru_ptr)); cout<<"Pushed to queue\n" ; } void MyObject::FrontOfQueue(std::unique_ptr<Packet> *inputFrame) { inputFrame = std::move(PacketQueue.front()); } int main() { cout<<"Hello World\n"; MyObject object; object.pushToQueue(); object.pushToQueue(); { // Scope std::unique_ptr<MyObject::Packet> *frame; object.FrontOfQueue(frame); cout<< frame << endl; } { // Scope std::unique_ptr<MyObject::Packet> *frame2; object.FrontOfQueue(frame2); cout<< frame2 << endl; } return 0; }

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