correct use of iterator to return an object from a list
<p>I have a list of meetings:</p>

<pre><code>std::list&lt;meeting*&gt; meetings;
</code></pre>

<p>I want to iterate the list and return a reference to a specific meeting:</p>

<pre><code>meeting&amp; day::findMeeting( float StartHour )
{
std::list&lt;meeting*&gt;::iterator it;
for(it = meetings.begin(); it != meetings.end(); it++)
{
    if (it-&gt;getStartHour() == StartHour)
    {
        return *it;
    }
}
throw no_such_meeting_error;
}  
</code></pre>

<p>i get the following errors :</p>

<ol>
<li><code>'getStartHour' : is not a member of 'std::_List_iterator&lt;_Mylist&gt;'</code></li>
<li><code>'return' : cannot convert from 'meeting *' to 'meeting &amp;'</code></li>
<li><code>invalid return type 'meeting **' for overloaded 'operator -&gt;'</code></li>
</ol>

<p>I'm still learning c++ so would be happy to understand what i'm doing wrong. Also,</p>

<ul>
<li>Is it good practice to return a reference to an object from a function ? Is there something better to do ?</li>
<li>is it likely that the reference will be invalidated on some because of changes to the items in the list ?</li>
</ul>

<p>Thanks</p>
