Changes in doc/papers/general/Paper.tex [e59f0bf:f86c8e5]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/Paper.tex
re59f0bf rf86c8e5 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 33 & 303 \\2629 source code size (lines) & 197 & 186 & 125 & 293 \\ 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); } 2927 stack( stack<T> && o) : head( o.head) { o.head = nullptr; } 2926 stack( const stack<T> & o ) { copy( o ); } 2928 2927 ~stack() { clear(); } 2929 2928 stack & operator= ( const stack<T> & o) { 2930 2929 if ( this == &o ) return *this; 2931 2930 clear(); 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; 2931 copy( o ); 2939 2932 return *this; 2940 2933 } 2941 2934 bool empty() const { return head == nullptr; } 2942 void push( const T & value ) { head = new node{ value, head }; /***/ }2935 void push( const T & value ) { head = new node{ value, head }; /***/ } 2943 2936 T pop() { 2944 2937 node * n = head; 2945 2938 head = n->next; 2946 T x = std::move( n->value );2939 T x = std::move( n->value ); 2947 2940 delete n; 2948 2941 return x; … … 2979 2972 stack() : head( nullptr ) {} 2980 2973 stack( const stack & o ) { copy( o ); } 2981 stack( stack && o ) : head( o.head ) { o.head = nullptr; } 2982 ~stack() { clear(); } 2974 ~stack() { clear(); } 2983 2975 stack & operator= ( const stack & o ) { 2984 2976 if ( this == &o ) return *this; 2985 2977 clear(); 2986 2978 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;2993 2979 return *this; 2994 2980 }
Note: See TracChangeset
for help on using the changeset viewer.