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 17:02:26


#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@…):

 The design rationale appears to be this comment in the code for a member
 of {{{directory_iterator}}}:
 {{{
 #!div style="font-size: 80%"
   {{{#!cpp
     // shared_ptr provides shallow-copy semantics required for
 InputIterators.
     // m_imp.get()==0 indicates the end iterator.
     boost::shared_ptr< detail::dir_itr_imp > m_imp;
   }}}
 }}}
 While the single-pass requirement is clear from the {{{InputIterator}}}
 concept, I don't see how it requires this shallow-copy behavior, which
 appears to me to be a defect in the design/code, as described above.

 I took a closer look to see what it would take to change that
 {{{shared_ptr}}} to a {{{unique_ptr}}} (or similar) in order to move
 {{{directory_iterator}}} to deep-copy semantics, but
 {{{detail::dir_itr_imp}}} would also need them and that looked platform-
 specific and non-trivial.

 I'd be willing to take a whack at creating a patch if you tell me it is a
 desired change, though I mainly work with mainstream platforms like
 Windows and POSIX/Linux and so couldn't easily test others.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12578#comment:5>
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