title: How to find a struct list item
body: <p>I have a list of struct that is described below:</p>
  
  <pre><code>struct Files
  {
      string id;
      string path;
      string chksum;
  };
  </code></pre>
  
  <p>And a variable that contains a list of this struct that describes a file list with the fields <code>id</code>, <code>path</code> and <code>chksum</code>.</p>
  
  <pre><code>list&lt;Files&gt; myFiles;
  </code></pre>
  
  <p>I need to implement an function that searches if a determined filename is present in my list.</p>
  
  <p>I tried to use the <code>find_if</code> algorithm but I am getting very strange errors, and I am not sure how to implement this efficiently.</p>
  
  <pre><code>string filename = "mytext.txt";
  
  auto match = std::find_if(myFiles.cbegin(), myFiles.cend(), [] (const Files&amp; s) {
    return s.path == filename;
  });
  
  if (match != myFiles.cend()) 
  {
      cout &lt;&lt; "omg my file was found!!! :D";
  }
  else
  {
      cout &lt;&lt; "your file is not here :(";
  }
  </code></pre>