title: Iterator two dimensional list
body: <p>I am trying to scroll a two dimensional list with an iterator and I know that I'm missing something but I don't know what.</p>
  
  <p>So the idea is that I'll have some commands to parse.</p>
  
  <p><img src="https://i.stack.imgur.com/afnnO.png" alt="schema of my list"></p>
  
  <p>I put them on a list then I want to check if a member of the list is equal to "data.txt" for example. So I did an iterator for this, but as it is a two dimensional list with an std::pair inside it, I don't know how to implement this iterator. I did this but it isn't good, I can't read both list.</p>
  
  <pre><code>typedef std::list&lt;std::string&gt;  listStr;
  
  std::list &lt;std::pair&lt;listStr, int&gt; &gt;  _execCmd;
  
  
  int     Parser::execCmd()
  {
     std::list&lt;std::string&gt;::const_iterator i;
  
     for (i = _execCmd.front().first.begin(); i != _execCmd.back().first.end(); ++i)                                          
      {                                                         
        if (*i == "Search.txt")                                       
          execSearch();                                          
        else if (*i == "data.txt")                                  
          execData();
      }
    return (0);
  }
  </code></pre>
  
  <p>In that case, I stay on the first list "File.txt data.txt contact.txt" (cf: schema) and I can go through the second list "Search.txt employe.csv".</p>
  
  <p>I've tried this too:</p>
  
  <pre><code>int     Parser::execCmd()
  {
    std::list&lt;std::pair&lt;listStr, int&gt; &gt;::const_iterator i;
  
    for (i = _execCmd.begin(); i != _execCmd.end(); ++i)        
     {
       if (*i == "Search.txt")                                    
          execSearch();                                  
       else if (*i == "data.txt")                               
          execData();                           
     }
    return (0);
  }
  </code></pre>
  
  <p>But I can't compile this because I don't know how to compare the iterator with a string (<code>*i == "help"</code>)</p>
  
  <p>Somebody can help me please ?</p>