I have ;
class object {
// any private datas token in heap area
public :
~object () ;
};
<
I wrote this generic function template, which should help you:
template
void deleter(FwdIterator from, FwdIterator to)
{
while ( from != to )
{
delete *from;
from++;
}
}
Example:
struct object { ~object() { cout << "object deleted" << endl; } };
int main() {
vector
Output:
object deleted
object deleted
object deleted
object deleted
object deleted
Demo at ideone : http://www.ideone.com/t5PI0