title: C++ List Iterator to Function
body: <p>I'm trying to pass the iterator to a separate function to then do something with the element at that location in the list.</p>
  
  <p>This is not working for me.</p>
  
  <pre><code>#include &lt;list&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main(int argc, char *argv[])
  {
      void doSomething(iterator::&lt;int&gt; *it);
  
      list&lt;int&gt; intList;
  
      intList.push_back(10);
      intList.push_back(20);
      intList.push_back(10);
      intList.push_back(30);
  
      list&lt;int&gt;::iterator it;
  
  
  
      for (it = intList.begin(); it != intList.end(); it++)
      {
          if (*it == '10')
              doSomething(*it);
      };
  
      void doSomething(iterator &lt;int&gt; *it)
      {
          (*it) = 200;
      };
  }
  </code></pre>