Boost C++ Libraries: Ticket #3714: file_system::path::assign clears and appends, precluding assignment to a leading substring of self https://svn.boost.org/trac10/ticket/3714 <p> template &lt;class <a class="missing wiki">InputIterator</a>&gt; basic_path &amp; assign( <a class="missing wiki">InputIterator</a> first, <a class="missing wiki">InputIterator</a> last ) </p> <blockquote> <p> { m_path.clear(); append( first, last ); return *this; } </p> </blockquote> <p> 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. </p> <p> As stated most impl's will end up setting the first char to 0, so this seems to fix in those implementations: </p> <p> { </p> <blockquote> <p> typename string_type::value_type c; if(first!=last)c = *first; m_path.clear(); append( first, last ); if(first!=last) mPath<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> = c; return *this; </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3714 Trac 1.4.3 anonymous Sun, 06 Dec 2009 15:38:07 GMT <link>https://svn.boost.org/trac10/ticket/3714#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3714#comment:1</guid> <description> <p> m_path<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> = c; </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Mon, 16 Jan 2012 16:09:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3714#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3714#comment:2</guid> <description> <p> Fix by changeset <a class="ext-link" href="https://svn.boost.org/trac/boost/search?q=76541"><span class="icon">​</span>https://svn.boost.org/trac/boost/search?q=76541</a> </p> <p> Thanks for the report! </p> <p> --Beman </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Mon, 16 Jan 2012 16:09:55 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3714#comment:3 https://svn.boost.org/trac10/ticket/3714#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket