Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Good1
//Title of this code #include <iostream> #include <list> #include <memory> using namespace std; struct Node { int x; Node(int x) { this->x = int(x); } Node(const Node& n) { *this = Node(n); } }; typedef shared_ptr<Node> node_ptr; void print(list<node_ptr> l) { for (auto it = l.begin(); it != l.end(); ++it) cout << (*it)->x << " "; cout << endl; } template <class T1, class T2> class Prb { public: list<node_ptr> nodes; Prb& operator=(const Prb& p){ this->nodes = p.nodes; } }; int main() { list<node_ptr> a,b; a.push_back(node_ptr(new Node(1))); b.push_back(node_ptr(new Node(2))); a=b; a.push_back(node_ptr(new Node(3))); b.push_back(node_ptr(new Node(4))); print(a); print(b); Prb<int,int> A,B; A.nodes = a; B.nodes = b; A=B; A.nodes.push_back(node_ptr(new Node(5))); B.nodes.push_back(node_ptr(new Node(6))); print(A.nodes); print(B.nodes); }
run
|
edit
|
history
|
help
0
Fibonacci
CodeForces Div 3 - D
Longest Consecutive Subsequence
unicodeのテスト
HW0
PyramidTransitionMatrix_recursive
TemplateRemove
Mapas - convertir número telefónico
SpiralMatrix
StackTel