std::list is not remove? I get iterator error


#1

I just want using std::list remove() but I got error like this

“Semantic issue, Invaild operand to binary expression”

void EventManager::doMsgReceivedEvent(CCObject* obj)
{
CCString* pParam = (CCString**)obj;
CCLog);
if 1)
{

    auto iter = marketingBuffer.begin();

    while( iter != marketingBuffer.end() )
    {
        eventDB data =  static\_cast\<eventDB\>(\*iter);
        if(data.id  g\_comfirmId)

{
CCNotificationCenter::sharedNotificationCenter->removeObserver);
**marketingBuffer.remove(data);*
return;
}
**iter;
}
// do Event
}
}
but Xcode is stop at there.
template<typename _Tp, typename _Alloc>
void
list<*Tp,*Alloc>::
remove
{
iterator first = begin;
iterator
last = end;
while
{
iterator *next =*first;
****next;
* if *
M_erase;
**first =
_next;
}
}

anyone help me out? Thank you


#2

I reply my self.

don’t use remove.

using erase(iterator)

so change that

marketingBuffer.remove(data); —->>>> marketingBuffer.erase(iter);

it is ok.