title: C++ no matching function for list::erase
body: <p>I am currently trying to cycle through a linked list of type <em>char</em>. When an argument is met (if it holds the letter 'w') I try to delete the list item using list::erase. I was just hoping to receive some advice towards using this function, I have only seen examples with type <em>int</em> linked lists, and I cannot tell if it won't work because it is <em>char</em> or what reason. When I try to compile the following code:</p>
  
  <pre><code>void filterFile(list &lt;char&gt; &amp;myList)
  {
      list&lt;char&gt;::const_iterator itr;
  
      for (itr = myList.begin(); itr != myList.end(); itr++ )
      { 
          if (*itr == 'w' || *itr == 'W'){
              itr = myList.erase (itr);
          }
      }
  }
  </code></pre>
  
  <p>I receive the compiling error:</p>
  
  <blockquote>
    <p>error: no matching function for call to ‘std::__cxx11::list::erase(std::__cxx11::list::const_iterator&amp;)’
         itr = myList.erase (itr);</p>
  </blockquote>
  
  <p>All of what I've done so far has been based off what I have found here
  <a href="http://www.cplusplus.com/reference/list/list/erase/" rel="nofollow">http://www.cplusplus.com/reference/list/list/erase/</a>.</p>
  
  <p>I also read about a node method to delete items in a list. I am just hoping to get this method working as it seems better and I am curious to learn what I've done wrong.</p>