function returning empty set
<p>I have the following function:</p>

<pre><code>ItemSet* Library::itemsForKeyword(const string&amp; keyword)
{
    ItemSet temp;

    for(it=bookList.begin();it!=bookList.end();it++){
        if(it-&gt;getPtr()-&gt;findKeyWord(it-&gt;getPtr()-&gt;keywordsList, keyword))
            temp.insert(*it);
    }

    ItemSet* temp2 = &amp;temp;
    return temp2;
}
</code></pre>

<p>ItemSet is a set which contains instances of ItemPtr, which contains pointers to instances of derived classes.  'it' is an iterator defined in Library, findKeyWord is a function that compares the keywordsList to the keyword to determine if that keyword is in that list.  if it returns true, then I dereference the iterator, and add the instance it is currently iterating to temp.  My issue is, when it is done with the loop, I return the temp2, but it returns empty, and causes an error when my print function goes to print it.  Why is it returning empty?  Thanks.</p>
