stack: 新增析构函数以解决退出程序时抛出异常的问题
This commit is contained in:
parent
3013ef372f
commit
5ec79bd146
|
@ -28,6 +28,15 @@ template <typename T, size_t capacity = 128>
|
||||||
class Stack
|
class Stack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Stack()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~Stack()
|
||||||
|
{
|
||||||
|
memset(arr, 0, sizeof(T) * capacity);
|
||||||
|
}
|
||||||
|
|
||||||
Stack &operator= (const Stack &other)
|
Stack &operator= (const Stack &other)
|
||||||
{
|
{
|
||||||
memcpy(arr, other.arr, length());
|
memcpy(arr, other.arr, length());
|
||||||
|
|
Loading…
Reference in New Issue