Пример #1
0
        public T pop_back()
        {
            if (this.empty())
            {
                return(default(T));
            }
            T res = this.last.val;

            this.last = this.last.prev;
            length--;
            return(res);
        }
Пример #2
0
        public T pop_front()
        {
            if (this.empty())
            {
                return(default(T));
            }
            T res = this.first.val;

            this.first = this.first.next;
            length--;
            return(res);
        }
Пример #3
0
        public void push_front(T x)
        {
            wezel <T> w = new wezel <T> (x);

            if (this.empty())
            {
                this.first = w;
                this.last  = w;
                this.length++;
            }
            else
            {
                w.next          = this.first;
                this.first.prev = w;
                this.first      = w;
                this.length++;
            }
        }