2706. Error reporting for recursive_directory_iterator::pop() is under-specified

Section: 30.11.13 [fs.class.rec.dir.itr] Status: C++17 Submitter: Eric Fiselier Opened: 2016-05-09 Last modified: 2017-07-30

Priority: 0

View all issues with C++17 status.

Discussion:

Unlike increment, pop() does not specify how it reports errors nor does it provide a std::error_code overload. However implementing pop() all but requires performing an increment, so it should handle errors in the same way.

Proposed resolution:

This wording is relative to N4582.

  1. Change 30.11.13 [fs.class.rec.dir.itr], class recursive_directory_iterator synopsis, as indicated:

    namespace std::filesystem {
      class recursive_directory_iterator {
      public:
        […]
        void pop();
        void pop(error_code& ec);
        void disable_recursion_pending();
        […]
      };
    }
    
  2. Change 30.11.13.1 [fs.rec.dir.itr.members] as indicated:

    void pop();
    void pop(error_code& ec);
    

    -30- Requires: *this != recursive_directory_iterator().

    -31- Effects: If depth() == 0, set *this to recursive_directory_iterator(). Otherwise, cease iteration of the directory currently being iterated over, and continue iteration over the parent directory.

    -?- Throws: As specified in Error reporting (30.5.6.5 [error.reporting]).