c.erase(p) can't be compiled successfully, why?
<p>I had tried to test the erase function in list, but I can't succeed! The error message of my compiler is:</p>

<pre><code>[Error]error: no matching function for call to
`std::list&lt;int,std::allocator&lt;int&gt; &gt;::erase(std::_List_const_iterator&lt;int&gt;&amp;)'.
</code></pre>

<p>My code as follows:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;list&gt;
using namespace std;

int main()
{
    int ia[] = {0, 1, 1, 2, 3, 5, 8, 13, 21, 55, 89};
    list&lt;int&gt; ilst(ia, ia + 11);

    list&lt;int&gt;::const_iterator iter2 = ilst.begin();
    for(; iter2 != ilst.end(); ++iter2)
    {
     if(*iter2 % 2 != 0)
     { 
      iter2 = ilst.erase(iter2); //error!
      --iter2;
     }
    }
    iter2 = ilst.begin(); 
    for(; iter2 != ilst.end(); ++iter2)
    {
     cout &lt;&lt; *iter &lt;&lt; " ";
    } 
    cout &lt;&lt; endl;
}
</code></pre>

<p>Thank you for your guide!</p>
