stack: 新增析构函数以解决退出程序时抛出异常的问题

This commit is contained in:
Calcitem 2019-10-15 22:45:44 +08:00
parent 3013ef372f
commit 5ec79bd146
1 changed files with 9 additions and 0 deletions

View File

@ -28,6 +28,15 @@ template <typename T, size_t capacity = 128>
class Stack
{
public:
Stack()
{
}
~Stack()
{
memset(arr, 0, sizeof(T) * capacity);
}
Stack &operator= (const Stack &other)
{
memcpy(arr, other.arr, length());