Changes in doc/papers/general/Paper.tex [f86c8e5:e59f0bf]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/Paper.tex
rf86c8e5 re59f0bf 2627 2627 & \CT{C} & \CT{\CFA} & \CT{\CC} & \CT{\CCV} \\ \hline 2628 2628 maximum memory usage (MB) & 10,001 & 2,502 & 2,503 & 11,253 \\ 2629 source code size (lines) & 197 & 186 & 1 25 & 293 \\2629 source code size (lines) & 197 & 186 & 133 & 303 \\ 2630 2630 redundant type annotations (lines) & 27 & 0 & 2 & 16 \\ 2631 2631 binary size (KB) & 14 & 257 & 14 & 37 \\ … … 2904 2904 T value; 2905 2905 node * next; 2906 node( const T & v, node * n = nullptr ) : value( v ), next( n) {}2906 node( const T & v, node * n = nullptr ) : value( v), next( n) {} 2907 2907 }; 2908 2908 node * head; … … 2915 2915 head = nullptr; 2916 2916 } 2917 void copy( const stack<T> & o 2917 void copy( const stack<T> & o) { 2918 2918 node ** crnt = &head; 2919 for ( node * next = o.head; next; next = next->next ) {2919 for ( node * next = o.head;; next; next = next->next ) { 2920 2920 *crnt = new node{ next->value }; /***/ 2921 2921 crnt = &(*crnt)->next; … … 2924 2924 } 2925 2925 stack() : head( nullptr) {} 2926 stack( const stack<T> & o ) { copy( o ); } 2926 stack( const stack<T> & o) { copy( o); } 2927 stack( stack<T> && o) : head( o.head) { o.head = nullptr; } 2927 2928 ~stack() { clear(); } 2928 2929 stack & operator= ( const stack<T> & o) { 2929 2930 if ( this == &o ) return *this; 2930 2931 clear(); 2931 copy( o ); 2932 copy( o); 2933 return *this; 2934 } 2935 stack & operator= ( stack<T> && o) { 2936 if ( this == &o ) return *this; 2937 head = o.head; 2938 o.head = nullptr; 2932 2939 return *this; 2933 2940 } 2934 2941 bool empty() const { return head == nullptr; } 2935 void push( const T & value 2942 void push( const T & value) { head = new node{ value, head }; /***/ } 2936 2943 T pop() { 2937 2944 node * n = head; 2938 2945 head = n->next; 2939 T x = std::move( n->value 2946 T x = std::move( n->value); 2940 2947 delete n; 2941 2948 return x; … … 2972 2979 stack() : head( nullptr ) {} 2973 2980 stack( const stack & o ) { copy( o ); } 2974 ~stack() { clear(); } 2981 stack( stack && o ) : head( o.head ) { o.head = nullptr; } 2982 ~stack() { clear(); } 2975 2983 stack & operator= ( const stack & o ) { 2976 2984 if ( this == &o ) return *this; 2977 2985 clear(); 2978 2986 copy( o ); 2987 return *this; 2988 } 2989 stack & operator= ( stack && o ) { 2990 if ( this == &o ) return *this; 2991 head = o.head; 2992 o.head = nullptr; 2979 2993 return *this; 2980 2994 }
Note: See TracChangeset
for help on using the changeset viewer.