title: boost directory iterator
body: <p>I have this piece of Boost code that iterates through files in a directory: </p>
  
  <pre><code>void someFuncToIterateFiles() {
  
      if( exists( directory ) )
      {
         directory_iterator end ;
  
         for( directory_iterator iter(directory) ; iter != end ; ++iter ) {
           if ( !is_directory( *iter ) )
           {
               // this is a file 
               cout &lt;&lt; iter-&gt;path; 
  
               // rest of the code
           }
         }
      }
  }
  </code></pre>
  
  <p>I have found that sometimes when its read a directory which exists and is about to start iterating through files, the program simply halts and there is no error or segmentation fault. The rest of the code bit is not executed at all, and the function returns to the caller This is very strange as I haven't come across anything like this before. No exception is thrown, unless this needs us to explicitly use a try-catch exception handler. </p>
  
  <p>Has anyone experienced this with Boost? I cannot debug but only use cout statements as some of my dependency libraries are compiled in release mode. </p>