//: :purge.h // From Thinking in C++, 2nd Edition // Available at http://www.BruceEckel.com // (c) Bruce Eckel 2000 // Copyright notice in Copyright.txt // Delete pointers in an STL sequence container #ifndef PURGE_H #define PURGE_H #include template void purge(Seq& c) { typename Seq::iterator i; for(i = c.begin(); i != c.end(); i++) { delete *i; *i = 0; } } // Iterator version: template void purge(InpIt begin, InpIt end) { while(begin != end) { delete *begin; *begin = 0; begin++; } } #endif // PURGE_H ///:~