Ignore:
Timestamp:
May 18, 2018, 2:09:21 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
2472a19
Parents:
f6f0cca3 (diff), c7d8100c (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.
Message:

Merge remote-tracking branch 'origin/master' into with_gc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/evaluation/cpp-vstack.cpp

    rf6f0cca3 rff29f08  
    44stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}
    55
     6void 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}
     14
    615void stack::clear() {
    7         for ( node * next = head; next; ) {
    8                 node * crnt = next;
    9                 next = crnt->next;
    10                 delete crnt;
     16        for ( node * nx = head; nx; ) {
     17                node * cr = nx;
     18                nx = cr->next;
     19                delete cr;
    1120        }
    1221        head = nullptr;
    13 }
    14 
    15 void stack::copy( const stack & o ) {
    16         node ** crnt = &head;
    17         for ( node * next = o.head; next; next = next->next ) {
    18                 *crnt = new node{ *next->value }; /***/
    19                 crnt = &(*crnt)->next;
    20         }
    21         *crnt = nullptr;
    2222}
    2323
     
    3333}
    3434
    35 bool stack::empty() const { return head == nullptr; }
     35bool stack::empty() const {
     36        return head == nullptr;
     37}
    3638
    37 void stack::push( const object & value ) { head = new node{ value, head }; /***/ }
     39void stack::push( const object & value ) {
     40        head = new node{ value, head }; /***/
     41}
    3842
    3943ptr<object> stack::pop() {
Note: See TracChangeset for help on using the changeset viewer.