[Boost-bugs] [Boost C++ Libraries] #3714: file_system::path::assign clears and appends, precluding assignment to a leading substring of self

Subject: [Boost-bugs] [Boost C++ Libraries] #3714: file_system::path::assign clears and appends, precluding assignment to a leading substring of self
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-12-04 00:26:48


#3714: file_system::path::assign clears and appends, precluding assignment to a
leading substring of self
-------------------------------------------+--------------------------------
 Reporter: joe.pendergast@… | Owner: bemandawes
     Type: Bugs | Status: new
Milestone: Boost 1.42.0 | Component: filesystem
  Version: Boost 1.41.0 | Severity: Problem
 Keywords: path assign leading substring |
-------------------------------------------+--------------------------------
 template <class InputIterator>
 basic_path & assign( InputIterator first, InputIterator last )
       { m_path.clear(); append( first, last ); return *this; }

 this implementation precludes assigning to a path a leading substring of
 that path itself because most impl's string_type::clear will end up
 setting the first char to 0. I could not find documentation that
 explicitly precludes this.

 As stated most impl's will end up setting the first char to 0, so this
 seems to fix in those implementations:

 {
    typename string_type::value_type c;
    if(first!=last)c = *first;
    m_path.clear();
    append( first, last );
    if(first!=last) mPath[0] = c;
    return *this;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3714>
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:02 UTC