Ignore:
Timestamp:
May 3, 2018, 4:33:19 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
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.
Message:

Merge branch 'master' into fix-reference-overloading

File:
1 edited

Legend:

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

    rf465f0e r779a4a3  
    33
    44stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}
     5
     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}
    514
    615void stack::clear() {
     
    1120        }
    1221        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;
    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.