title: How can I assign boost::filesystem::directory_entry::path() value to a string?
body: <p>I'm trying to write an algorithm that iterates recursively through a directory and compares each folder, sub-folder and file name to a user-defined regex object.</p>
  
  <p>I've found this piece of code for the iteration part:</p>
  
  <pre><code>path p(FilePath);
  for (directory_entry&amp; x : recursive_directory_iterator(p))
      std::cout &lt;&lt; x.path() &lt;&lt; '\n';
  </code></pre>
  
  <p>Where <em>Filepath</em> is the directory path defined by the user at runtime.</p>
  
  <p>It works great to print out paths on the console, but I can't figure out a way to use path() to do what I want, which would be to assign its value to a string and then compare that string to my regex object.</p>
  
  <p>I've been looking at other member function in boost::filesystem::directory_entry but I'm not really having any luck so far.</p>
  
  <p>Could anyone point me in the right direction?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT:</p>
  
  <p>I'm dumb.</p>