链式栈StackT(答案)

答案如下

#include 
#include 

//------下面的代码是用来测试你的代码有没有问题的辅助代码,你无需关注------
#include 
#include 
#include  
#include 
#include 
using namespace std;
struct Record { Record(void* ptr1, size_t count1, const char* location1, int line1, bool is) :ptr(ptr1), count(count1), line(line1), is_array(is) { int i = 0; while ((location[i] = location1[i]) && i < 100) { ++i; } }void* ptr; size_t count; char location[100] = { 0 }; int line; bool is_array = false; bool not_use_right_delete = false; }; bool operator==(const Record& lhs, const Record& rhs) { return lhs.ptr == rhs.ptr; }std::vector myAllocStatistic; void* newFunctionImpl(std::size_t sz, char const* file, int line, bool is) { void* ptr = std::malloc(sz); myAllocStatistic.push_back({ ptr,sz, file, line , is }); ret

你可能感兴趣的:(知乎,C++数据结构与算法,答案,c++,算法,开发语言)