std::vector 错误 DAMAGE: before Normal block (#51)
#include <iostream>
#include <vector>
#include <windows.h>
#include <time.h>
#include <algorithm>
using namespace std;
bool change(int dd, int mm)
{
int value1 = rand();
int value2 = rand();
return value1 > value2;
}
void main()
{
vector<int> list;
time_t tt = GetTickCount();
tm *t = localtime(&tt);
for (int i = 0; i < 20; ++i)
{
list.push_back(i);
}
std::sort(list.begin(), list.end(), change);
for (i = 0; i < list.size(); ++i)
{
cout<<list[i]<<' ';
}
cout<<endl;
}
今天写代码的时候发现的一个问题,貌似是内存泄露,但实在找不到原因。。忘各位大虾指教一二。。