|
#pragma once
#include <vector>
using namespace std;
template <typename T>
bool DepCopyVector( const vector<T*>& src,vector<T*>& dest )
  {
for (vector<T*>::const_iterator it=src.begin();
it!=src.end();
++it)
 {
T* pNew = new T;
if (pNew==NULL)
 {
return false;
}
*pNew = *(*it);
dest.push_back(pNew);
}
return true;
}

template <typename T>
void DepClearVector( vector<T*>& v )
  {
for (vector<T*>::iterator it=v.begin();
it!=v.end();
++it)
 {
delete *it;
*it=NULL;
}
v.clear();
}

|