- File:
-
- 1 edited
-
doc/papers/general/evaluation/cpp-vstack.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/evaluation/cpp-vstack.cpp
r4c80a75 rac4dad2 3 3 4 4 stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {} 5 6 void stack::clear() { 7 for ( node * nx = head; nx; ) { 8 node * cr = nx; 9 nx = cr->next; 10 delete cr; 11 } 12 head = nullptr; 13 } 5 14 6 15 void stack::copy( const stack & o ) { … … 11 20 } 12 21 *cr = nullptr; 13 }14 15 void stack::clear() {16 for ( node * nx = head; nx; ) {17 node * cr = nx;18 nx = cr->next;19 delete cr;20 }21 head = nullptr;22 22 } 23 23 … … 33 33 } 34 34 35 bool stack::empty() const { 36 return head == nullptr; 37 } 35 bool stack::empty() const { return head == nullptr; } 38 36 39 void stack::push( const object & value ) { 40 head = new node{ value, head }; /***/ 41 } 37 void stack::push( const object & value ) { head = new node{ value, head }; /***/ } 42 38 43 39 ptr<object> stack::pop() {
Note:
See TracChangeset
for help on using the changeset viewer.