Changeset 779a4a3 for doc/papers/general/evaluation/cpp-vstack.cpp
- Timestamp:
- May 3, 2018, 4:33:19 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- f3152ab
- Parents:
- f465f0e (diff), c9d5c4f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/evaluation/cpp-vstack.cpp
rf465f0e r779a4a3 3 3 4 4 stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {} 5 6 void stack::copy( const stack & o ) { 7 node ** cr = &head; 8 for ( node * nx = o.head; nx; nx = nx->next ) { 9 *cr = new node{ *nx->value }; /***/ 10 cr = &(*cr)->next; 11 } 12 *cr = nullptr; 13 } 5 14 6 15 void stack::clear() { … … 11 20 } 12 21 head = nullptr; 13 }14 15 void stack::copy( const stack & o ) {16 node ** cr = &head;17 for ( node * nx = o.head; nx; nx = nx->next ) {18 *cr = new node{ *nx->value }; /***/19 cr = &(*cr)->next;20 }21 *cr = nullptr;22 22 } 23 23 … … 33 33 } 34 34 35 bool stack::empty() const { return head == nullptr; } 35 bool stack::empty() const { 36 return head == nullptr; 37 } 36 38 37 void stack::push( const object & value ) { head = new node{ value, head }; /***/ } 39 void stack::push( const object & value ) { 40 head = new node{ value, head }; /***/ 41 } 38 42 39 43 ptr<object> stack::pop() {
Note: See TracChangeset
for help on using the changeset viewer.