Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/Paper.tex

    rf86c8e5 re59f0bf  
    26272627                                                                        & \CT{C}        & \CT{\CFA}     & \CT{\CC}      & \CT{\CCV}             \\ \hline
    26282628maximum memory usage (MB)                       & 10,001        & 2,502         & 2,503         & 11,253                \\
    2629 source code size (lines)                        & 197           & 186           & 125           & 293                   \\
     2629source code size (lines)                        & 197           & 186           & 133           & 303                   \\
    26302630redundant type annotations (lines)      & 27            & 0                     & 2                     & 16                    \\
    26312631binary size (KB)                                        & 14            & 257           & 14            & 37                    \\
     
    29042904                T value;
    29052905                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) {}
    29072907        };
    29082908        node * head;
     
    29152915                head = nullptr;
    29162916        }
    2917         void copy( const stack<T> & o ) {
     2917        void copy( const stack<T> & o) {
    29182918                node ** crnt = &head;
    2919                 for ( node * next = o.head; next; next = next->next ) {
     2919                for ( node * next = o.head;; next; next = next->next ) {
    29202920                        *crnt = new node{ next->value }; /***/
    29212921                        crnt = &(*crnt)->next;
     
    29242924        }
    29252925        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; }
    29272928        ~stack() { clear(); }
    29282929        stack & operator= ( const stack<T> & o) {
    29292930                if ( this == &o ) return *this;
    29302931                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;
    29322939                return *this;
    29332940        }
    29342941        bool empty() const { return head == nullptr; }
    2935         void push( const T & value ) { head = new node{ value, head };  /***/ }
     2942        void push( const T & value) { head = new node{ value, head };  /***/ }
    29362943        T pop() {
    29372944                node * n = head;
    29382945                head = n->next;
    2939                 T x = std::move( n->value );
     2946                T x = std::move( n->value);
    29402947                delete n;
    29412948                return x;
     
    29722979        stack() : head( nullptr ) {}
    29732980        stack( const stack & o ) { copy( o ); }
    2974                 ~stack() { clear(); }
     2981        stack( stack && o ) : head( o.head ) { o.head = nullptr; }
     2982        ~stack() { clear(); }
    29752983        stack & operator= ( const stack & o ) {
    29762984                if ( this == &o ) return *this;
    29772985                clear();
    29782986                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;
    29792993                return *this;
    29802994        }
Note: See TracChangeset for help on using the changeset viewer.