/* * EmptyPrototypeTable.hpp * * Created on: Jan 3, 2011 * Author: heber */ #ifndef EMPTYPROTOTYPETABLE_HPP_ #define EMPTYPROTOTYPETABLE_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif /** Removes all pointers to instances from a table while free'ing memory. * * I.e. we assume class T to be a map of some key with its values pointers to * some classes that have to be free'd. * * \param _PrototypeTable table to empty */ template void EmptyPrototypeTable(T &_PrototypeTable) { for (typename T::iterator iter = _PrototypeTable.begin(); !_PrototypeTable.empty(); iter = _PrototypeTable.begin()) { delete (iter->second); _PrototypeTable.erase(iter); } _PrototypeTable.clear(); } #endif /* EMPTYPROTOTYPETABLE_HPP_ */