Stl Set find an item c++
<p>I have a set where i want to find items in it. Right now i have global objects that i am using to store my finds - (ItemSetMap allMusicByBand)</p>

<p>I would like to get away from this and just search the sets directly.</p>

<p>All the cd info are stored in the private section - (ItemSet allCDS;)</p>

<p>here is the library.cpp - </p>

<p>the commented code is where i  was doing my search and adding to the global object...</p>

<p>I would like to do the search in the musicByBand function instead..</p>

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

#include &lt;iostream&gt;




//ItemSetMap allBooksByAuthor;       //these are what i am trying to get away from...
ItemSetMap allmoviesByDirector;
ItemSetMap allmoviesByActor;

//ItemSetMap allMusicByBand;
ItemSetMap allMusicByMusician;


const Item* Library::addMusicCD(const string&amp; title, const string&amp; band, const int nSongs)
{

CD* item = new CD(title,band,nSongs);

allCDS.insert(item);

//ItemSetMap::iterator myband = allMusicByBand.find(band);

//if(myband != allMusicByBand.end())
//{
    //myband-&gt;second-&gt;insert(item);

//}
//else{
    //ItemSet* obj = new ItemSet();
    //obj-&gt;insert(item);
    //allMusicByBand.insert(make_pair(band, obj));
//}




return item;
    }


const ItemSet* Library::musicByBand(const string&amp; band) const
{



return allMusicByBand[author];
}
</code></pre>

<p>i hope i was clear enough on what i wanted. </p>

<p>I have tried to iterate through it. I have tried just about everything i can think of..
CD class is a superclass of item class.</p>

<p>Thank you..</p>
