Problem in erasing element in list
<pre><code>struct ScheduleTaskInfo
{
unsigned int nTaskID;
   __time64_t timeStartTime;
__time64_t timeEndTime; 
};

typedef list&lt;ScheduleTaskInfo&gt; SchedulerList;   

SchedulerList::iterator itrSchedulerList;    
for(itrSchedulerList = gSchedulerList.begin();itrSchedulerList != gSchedulerList.end();itrSchedulerList++)
{
    SYSTEMTIME st;
    GetLocalTime(&amp;st);

    CTime ctSyatemTime(st);

    if (itrSchedulerList-&gt;timeEndTime == ctSyatemTime.GetTime())
    {

        itrSchedulerList = gSchedulerList.erase(itrSchedulerList);          
    }

}
</code></pre>

<p>I am doing this it is crashing in for loop.I think it is due to erase();
Am I doing something wrong here??Please suggest me on this </p>
