I have a major amount of memory leaks. I know that the Sets have pointers and i cannot change that! but clean up the mess i have...
I am creating memory with new in just about every function to add information to the sets.
here is my potential leaks..
library.cpp
#include "Library.h"
#include "book.h"
#include "cd.h"
#include "dvd.h"
#include <iostream>
// general functions
ItemSet allBooks;
ItemSet allCDS;
ItemSet allDVDs;
ItemSetMap allBooksByAuthor;
ItemSetMap allmoviesByDirector;
ItemSetMap allmoviesByActor;
ItemSetMap allMusicByBand;
ItemSetMap allMusicByMusician;
const ItemSet* Library::itemsForKeyword(const string& keyword) const
{
const StringSet* kw;
ItemSet* obj = new ItemSet();
return obj;
const Item* Library::addBook(const string& title, const string& author, const int nPages)
{
ItemSet* obj = new ItemSet();
Book* item = new Book(title,author,nPages);
allBooks.insert(item); // add to set of all books
obj->insert(item);
return item;
Do, i need a copy constructor?