Changeset a381b46 for doc/generic_types/evaluation/cpp-stack.hpp
- Timestamp:
- Apr 15, 2017, 7:09:59 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:
- c57d1935
- Parents:
- 308880c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/cpp-stack.hpp
r308880c ra381b46 1 1 #pragma once 2 3 2 #include <utility> 4 3 … … 11 10 node( T&& v, node* n ) : value(std::move(v)), next(n) {} 12 11 }; 13 14 12 node* head; 15 13 … … 24 22 *crnt = nullptr; 25 23 } 26 27 24 public: 28 25 void clear() { … … 37 34 38 35 stack() : head(nullptr) {} 39 40 36 stack(const stack<T>& o) { copy(o); } 41 42 37 stack(stack<T>&& o) : head(o.head) { o.head = nullptr; } 43 44 38 ~stack() { clear(); } 45 39 … … 58 52 } 59 53 60 bool empty() const { 61 return head == nullptr; 62 } 54 bool empty() const { return head == nullptr; } 63 55 64 void push(T&& value) { 65 head = new node{ std::move(value), head }; /***/ 66 } 56 void push(T&& value) { head = new node{ std::move(value), head }; /***/ } 67 57 68 58 T pop() {
Note: See TracChangeset
for help on using the changeset viewer.