Changeset 4c80a75 for doc/papers/general/Paper.tex
- Timestamp:
- May 1, 2018, 9:17:06 AM (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, with_gc
- Children:
- 1518b39, 7f0001c, 94dea96
- Parents:
- 8a5bdf0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/Paper.tex
r8a5bdf0 r4c80a75 2875 2875 } 2876 2876 _Bool stack_empty( const stack * s ) { 2877 2877 return s->head == NULL; 2878 2878 } 2879 2879 void push_stack( stack * s, void * v ) { 2880 node * n = malloc( sizeof(node)); /***/2880 node * n = malloc( sizeof(node) ); /***/ 2881 2881 *n = (node){ v, s->head }; /***/ 2882 2882 s->head = n; … … 2908 2908 }; 2909 2909 struct stack { node(T) * head; }; 2910 void ?{}( stack(T) & s ) { (s.head){ 0 }; } 2911 void ?{}( stack(T) & s, stack(T) t ) { 2910 void ?{}( stack(T) & s, stack(T) t ) { // copy 2912 2911 node(T) ** cr = &s.head; 2913 2912 for ( node(T) * nx = t.head; nx; nx = nx->next ) { … … 2923 2922 nx = cr->next; 2924 2923 ^(*cr){}; 2925 free( cr);2924 free( cr ); 2926 2925 } 2927 2926 head = 0; 2928 2927 } 2928 2929 2929 \end{cfa} 2930 2930 & 2931 2931 \begin{cfa}[xleftmargin=0pt,aboveskip=0pt,belowskip=0pt] 2932 void ?{}( stack(T) & s ) { (s.head){ 0 }; } 2932 2933 void ^?{}( stack(T) & s) { clear( s ); } 2933 2934 stack(T) ?=?( stack(T) & s, stack(T) t ) { … … 2954 2955 } 2955 2956 } 2956 2957 2957 \end{cfa} 2958 2958 \end{tabular} … … 3003 3003 return *this; 3004 3004 } 3005 bool empty() const { return head == nullptr; } 3005 bool empty() const { 3006 return head == nullptr; 3007 } 3006 3008 void push( const T & value ) { 3007 3009 head = new node{ value, head }; /***/ … … 3015 3017 } 3016 3018 }; 3017 3018 3019 3019 3020 3020 \end{cfa} … … 3066 3066 return *this; 3067 3067 } 3068 bool empty() const { return head == nullptr; } 3068 bool empty() const { 3069 return head == nullptr; 3070 } 3069 3071 void push( const object & value ) { 3070 3072 head = new node{ value, head }; /***/ … … 3079 3081 }; 3080 3082 3081 3082 3083 3083 \end{cfa} 3084 3084 \end{tabular}
Note: See TracChangeset
for help on using the changeset viewer.