i am using a map to store an pair (int and class) using the following:
#include <iostream>
#include <utility>
#include <map>
using namespace std;
class abstractclass{...};
class derivedclass : public abstractclass{...};
typedef map<int,abstractclass*> dBase;
int main(){
dBase db;
db.insert(pair<int,abstractclass*>(123,new derivedclass));
db.insert(pair<int,abstractclass*>(124,new derivedclass));
}
How do i then delete the memory allocated to this?
I need to be able to use insert
a user defined amount of times so a method that can delete every database entry is preferred, thanks!
If theres a way i can do this without using memory allocation that would also be useful