jezv 1 年之前
父节点
当前提交
fc2bee4ed6
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      List.h

+ 6 - 1
List.h

@@ -79,8 +79,13 @@ class List
 
     virtual T pop()
     {
-        // Сделать проверку на пустой список
         T result = end->value;
+        if (end == start) {
+            end = nullptr;
+            start = nullptr;
+            lenght--;
+            return result;
+        }
         end = end->prev;
         end->next = nullptr;
         lenght--;