#include <list>
#include <string>
#include <time.h>
#include <sys/timeb.h>
using namespace std;
char * log_Time(void)
{
struct tm *ptm;
struct timeb stTimeb;
static char szTime[19];
ftime(&stTimeb);
ptm = localtime(&stTimeb.time);
sprintf(szTime, "%02d-%02d %02d:%02d:%02d.%03d",
ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, stTimeb.millitm);
szTime[18] = 0;
return szTime;
}
template<typename Container>
void removeEveryOtherItem(Container & lst)
{
typename Container::iterator itr = lst.begin();
while (itr != lst.end())
{
itr = lst.erase(itr);
if (itr != lst.end())
++itr;
}
}
int main()
{
int vecSize = 800000;
vector<int> data_vector;
list<int> data_list;
cout << log_Time() << endl;
cout << "插入Vector: " <<log_Time() << endl;
for (int i = 0;
对比Vector与List操作时间,以及用日志打印操作时间
最新推荐文章于 2024-04-17 22:26:15 发布