find an item in a stl set in c++
<p>I am trying to find an author in a set, and i am having problems doing so.</p>

<p>in the library.cpp is where i am adding the information from main()</p>

<pre><code>#include "Library.h"
#include "book.h"
#include "cd.h"
#include "dvd.h"

#include &lt;iostream&gt;
// general functions


ItemSet allBooks;
ItemSet allCDS;
ItemSet allDVDs;




ItemSetMap allBooksByAuthor;
ItemSetMap allmoviesByDirector;
ItemSetMap allmoviesByActor;

ItemSetMap allMusicByBand;
ItemSetMap allMusicByMusician;


const Item* Library::addBook(const string&amp; title, const string&amp; 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-&gt;insert(item);
    allBooksByAuthor[author] = obj;
    return item;

}

const ItemSet* Library::booksByAuthor(const string&amp; author) const
{

    return allBooksByAuthor[author];

}
</code></pre>

<p>I want to be able to return all the books by a particular author. Right now i am adding them by</p>

<p>allBooksByAuthor[author] = obj;</p>

<p>it does work. However,</p>

<p>it is a problem since its treating an author of two different books as a duplicate. 
so, it will only return one book.</p>

<p>What can i do.. keep in mind i cannot change the function or the sets. so, any const must stay... but can make a new set.</p>
