title: Traversing a directory with boost::filesystem without throwing exceptions
body: <p>I have a path to the directory, and I want to traverse through all of its sub-directories, collecting files' pathes by the way.</p>
  
  <pre><code>namespace fs = boost::filesystem;
  
  std::vector&lt;fs::path&gt; traverse_if_directory(fs::path&amp; f) {
      std::vector&lt;fs::path&gt; result;
      if (fs::is_directory(f)) {      
          for (fs::recursive_directory_iterator it(f), eit; it != eit; ++it) {
              if (!fs::is_directory(it-&gt;path())) {
                  result.push_back(it-&gt;path());
              }       
          }
      }
      else {
          result.push_back(f);
      }
  
      return result;
  }
  </code></pre>
  
  <p>Unfortunately, in the middle of the traversing, I stumble upon a directory which I have no rights to look at, and the code above throws. But obviously, in this scenario it's not an exception, I should just go on, skipping this locked directory.</p>
  
  <p>But how do I do this? </p>