Re: [Boost-bugs] [Boost C++ Libraries] #12578: Crash with boost::filesystem's directory_iterator and recursive_directory_iterator

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12578: Crash with boost::filesystem's directory_iterator and recursive_directory_iterator
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-11-21 19:07:36


#12578: Crash with boost::filesystem's directory_iterator and
recursive_directory_iterator
-------------------------------+------------------------
  Reporter: anonymous | Owner: bemandawes
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: filesystem
   Version: Boost 1.61.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+------------------------

Comment (by mlimber@…):

 Thanks, Charles.

 I see now: {{{InputIterator}}} and single-pass behavior means a copy of an
 iterator invalidates any other input iterators to the underlying source,
 akin to {{{std::istream_iterator}}}. My intuition was that a
 {{{directory_iterator}}} would be a {{{ForwardIterator}}}, and honestly I
 didn't fully grasp the distinction between those categories until now.

 Strictly speaking, there is no defect since this is documented, but (1)
 the documentation of this is too oblique, IMHO, and (2) I'm not clear on
 why directory iterators should not be {{{ForwardIterator}}}s.

 For (1), I would propose adjusting the wording of the notes on
 {{{directory_iterator}}} and {{{recursive_directory_iterator}}} to make
 this behavior more apparent, something like:

  Note: The practical consequence of not preserving equality is that
 directory iterators can only be used for single-pass algorithms. ''Also,
 each copy of an iterator shares state with all the copies, so when one is
 incremented, they are all effectively incremented.'' --end note

 For (2), I would think {{{ForwardIterator}}} would be the preferable
 concept here, so I'm not sure why {{{InputIterator}}} was chosen.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12578#comment:7>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC