| 168 | } |
| 169 | |
| 170 | ~Vector() |
| 171 | { |
| 172 | // 析构容器的有效元素,然后释放 _first 指针指向的堆内存 |
| 173 | for (T *p = _first; p != _last; ++ p) |
| 174 | { |
| 175 | _allocator.destroy(p); // 把 _first 指针指向的数组的有效元素进行析构 |
| 176 | } |
| 177 | _allocator.deallocate(_first); // 释放堆上的数组内存 |
| 178 | _first = _last = _end = nullptr; |
| 179 | } |
| 180 | |
| 181 | Vector(const Vector<T> &rhs) |
| 182 | { |
nothing calls this directly
no test coverage detected