title: How to make std::filesystem::directory_iterator to list filenames in order
body: <p>I am trying to get filenames in a directory "in order". I tried with c++ std::filesystem::directory_iterator to do so. As mentioned in <a href="https://en.cppreference.com/w/cpp/filesystem/directory_iterator" rel="noreferrer">https://en.cppreference.com/w/cpp/filesystem/directory_iterator</a> it provides all filenames in the directory, excluding "." and ".." operator but not in order. </p>
  
  <p>Kindly do help me out, Thanks in advance. </p>
  
  <p>Here is the simple code i used </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;experimental/filesystem&gt;
  #include &lt;vector&gt;
  
  int main 
  {
    // path to cereal folder 
    std::string path_to_cereal_folder = "/home/ros2/Documents";
  
    for (auto&amp; entry : std::experimental::filesystem::directory_iterator(path_to_cereal_folder) )
    {
        std::cout &lt;&lt; entry.path() &lt;&lt; std::endl;     
    }
    return 0;
  }
  </code></pre>