online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <list> using namespace std; class A{ private: list<int*> data; public: A(list<int*>& data_) : data(data_) {} list<int*>& getData() {return data;} }; int main(){ list<int*> temp; temp.push_back(new int(1)); temp.push_back(new int(2)); temp.push_back(new int(3)); temp.push_back(new int(4)); A a(temp); // First Iteration list<int*>::iterator it; cout<<(a.getData()).size()<<endl; for (it = (a.getData()).begin(); it != (a.getData()).end(); it++) cout << *(*it) << endl; // Second Iteration list<int*> mylist = a.getData(); for (it = mylist.begin(); it != mylist.end(); it++) cout << *(*it) << endl; }

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