title: directory_iterator - make a copy to "rewind"?
body: <p>So I wrote a small program to try out Boost Filesystem. My program will write how many files there is in the current path and then the file names.
  Here's my program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/filesystem.hpp&gt;
  
  using namespace boost::filesystem;
  
  int main(){
      directory_iterator start = directory_iterator(current_path());
      directory_iterator di = start;
      int count;
      for (count = 0; di != directory_iterator(); ++di, ++count);
      std::cout &lt;&lt; std::endl &lt;&lt; "total number of files: " &lt;&lt; count &lt;&lt; std::endl;
      di = start;
      for (; di != directory_iterator(); ++di){
          std::cout &lt;&lt; *di &lt;&lt; std::endl;
      }
      return 0;
  }
  </code></pre>
  
  <p>files existing are program.exe, .ilk and .pdb<br>
  However I get the following output (whole path left out for brevity):</p>
  
  <blockquote>
    <p>$ program.exe<br>
    total number of files: 3<br>
    [..]/program.pdb<br>
    Assertion failed: m_imp->m_handle != 0 &amp;&amp; "internal program error", file c:\program files\boost\boost_1_44\boost\filesystem\v2\operations.hpp, line 1001</p>
  </blockquote>
  
  <p>If I do a new directory_iterator instead it works fine:</p>
  
  <pre><code>di = start;
  // .. becomes ..
  di = directory_iterator(current_path());
  </code></pre>
  
  <p>I noticed a <a href="https://stackoverflow.com/questions/5381309/how-to-make-a-copy-of-boostfilesystemdirectory-iterator">similar question</a> related to directory_iterators but I have no idea what they are referring to or if it's the same issue.</p>
  
  <p>Question is:
  Why can't I save a startiterator and then use that to rewind my iterator?</p>