fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template < typename T > class Container{
  6. public:
  7. T val;
  8. Container(){}
  9. Container(T _val){
  10. val = _val;
  11. }
  12. };
  13.  
  14. template < typename T > class Deque{
  15. public:
  16. Container<T>* head;
  17. Container<T>* tail;
  18. Deque< pair<T, T> > *child;
  19. Deque<T>(){}
  20. Deque<T>(Container<T>* _head, Deque< pair<T, T> > *_child, Container<T>* _tail){
  21. head = _head;
  22. child = _child;
  23. tail = _tail;
  24. }
  25. Deque<T>* push_front(T x){
  26. if (this == NULL)
  27. return new Deque<T>(new Container<T>(x), NULL, NULL);
  28. if (head == NULL)
  29. return new Deque<T>(new Container<T>(x), child, tail);
  30. return new Deque<T>(NULL, child->push_front(make_pair(x, head->val)), tail);
  31. }
  32. };
  33.  
  34. int main(){
  35. Deque<int> d;
  36. int a = 1;
  37. d.push_front(a);
  38. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
cc1plus: out of memory allocating 1134881262 bytes after a total of 3776512 bytes
stdout
Standard output is empty