Index: src/ch/charvect.h =================================================================== diff -u -r3493e9fc470285b0a0b417d50be281467a071eb7 -rebabad67cdda34ed4e36ab794e10d0ade8124bf3 --- src/ch/charvect.h (.../charvect.h) (revision 3493e9fc470285b0a0b417d50be281467a071eb7) +++ src/ch/charvect.h (.../charvect.h) (revision ebabad67cdda34ed4e36ab794e10d0ade8124bf3) @@ -63,33 +63,68 @@ { size_type _Size=_tcslen(_Val)+1; PTSTR *ppsz=new PTSTR[_Count]; - for (size_type i=0;i<_Count;i++) + try { + for (size_type i=0;i<_Count;i++) + { + ppsz[i]=new TCHAR[_Size]; + _tcscpy(ppsz[i], _Val); + } + + ((vector*)this)->insert(_Where, ppsz, ppsz+_Count); + } + catch(...) + { + delete [] ppsz; + throw; + } + delete [] ppsz; + } + else + ((vector*)this)->insert(_Where, _Count, _Val); + }; + void insert(iterator _Where, size_type _Count, const PCTSTR& _Val) + { + size_type _Size=_tcslen(_Val)+1; + PTSTR *ppsz=new PTSTR[_Count]; + try + { + for(size_type i=0;i<_Count;i++) + { ppsz[i]=new TCHAR[_Size]; _tcscpy(ppsz[i], _Val); } ((vector*)this)->insert(_Where, ppsz, ppsz+_Count); + } + catch(...) + { delete [] ppsz; } - else - ((vector*)this)->insert(_Where, _Count, _Val); }; template void insert(iterator _Where, _It _First, _It _Last, bool bCopy) { if (bCopy) { size_type _Cnt=_Last-_First; PTSTR *ppsz=new PTSTR[_Cnt]; - for (size_type i=0;i<_Cnt;i++) + try { - ppsz[i]=new TCHAR[_tcslen(*_First)+1]; - _tcscpy(ppsz[i], *_First); + for (size_type i=0;i<_Cnt;i++) + { + ppsz[i]=new TCHAR[_tcslen(*_First)+1]; + _tcscpy(ppsz[i], *_First); - _First++; - } + _First++; + } - ((vector*)this)->insert(_Where, ppsz, ppsz+_Cnt); + ((vector*)this)->insert(_Where, ppsz, ppsz+_Cnt); + } + catch(...) + { + delete [] ppsz; + throw; + } delete [] ppsz; } else @@ -100,6 +135,7 @@ void pop_back(bool bDelete) { if (bDelete) delete [] (*(end()-1)); ((vector*)this)->pop_back(); }; void push_back(const PTSTR& _Val, bool bCopy) { insert(end(), 1, _Val, bCopy); }; + void push_back(const PCTSTR& _Val) { insert(end(), 1, _Val); }; }; #endif \ No newline at end of file