Changeset 79b8dc3 for doc/generic_types/evaluation/cpp-vstack.cpp
- Timestamp:
- Apr 14, 2017, 6:24:35 PM (7 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, resolv-new, with_gc
- Children:
- 17f27d40, 1c38f5b, 6eb4398
- Parents:
- 4570131
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/cpp-vstack.cpp
r4570131 r79b8dc3 5 5 stack::node::node( const object& v ) : value( v.new_copy() ), next( nullptr ) {} 6 6 7 stack::node::node( std::unique_ptr<object>&& v, node* n ) : value( std::move(v) ), next( n ) {}7 stack::node::node( ptr<object>&& v, node* n ) : value( std::move(v) ), next( n ) {} 8 8 9 9 void stack::copy(const stack& o) { … … 50 50 } 51 51 52 bool stack::empty() const { 53 return head == nullptr; 54 } 52 bool stack::empty() const { return head == nullptr; } 55 53 56 void stack::push(std::unique_ptr<object>&& value) { 57 head = new node{ std::move(value), head }; /***/ 58 } 54 void stack::push(ptr<object>&& value) { head = new node{ std::move(value), head }; /***/ } 59 55 60 std::unique_ptr<object> stack::pop() {56 ptr<object> stack::pop() { 61 57 node* n = head; 62 58 head = n->next; 63 std::unique_ptr<object> x = std::move(n->value);59 ptr<object> x = std::move(n->value); 64 60 delete n; 65 61 return x;
Note: See TracChangeset
for help on using the changeset viewer.