Boost C++ Libraries: Ticket #4716: boost::filesystem::path operator>> drops leading slash. https://svn.boost.org/trac10/ticket/4716 <p> The problem manifests itself most obviously using boost::lexical_cast. See the attached test case. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4716 Trac 1.4.3 norman.wilson@… Wed, 06 Oct 2010 12:34:08 GMT attachment set https://svn.boost.org/trac10/ticket/4716 https://svn.boost.org/trac10/ticket/4716 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">comn_pathlexicalcast_test.cpp</span> </li> </ul> <p> Unit test for lexical_cast&lt;path&gt; </p> Ticket luke@… Tue, 19 Oct 2010 19:02:10 GMT <link>https://svn.boost.org/trac10/ticket/4716#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4716#comment:1</guid> <description> <p> I ran into this same issue. However, I think its actually worse than dropping the leading slash. It drops the leading character whatever it is unless it is a double quote. </p> <p> boost\filesystem\v3\path.hpp </p> <p> template &lt;class Char, class Traits&gt; inline std::basic_istream&lt;Char, Traits&gt;&amp; operator&gt;&gt;(std::basic_istream&lt;Char, Traits&gt;&amp; is, path&amp; p) { </p> <blockquote> <p> std::basic_string&lt;Char&gt; str; is &gt;&gt; boost::io::quoted(str, static_cast&lt;Char&gt;('&amp;')); p = str; return is; </p> </blockquote> <p> } </p> <p> The problem is coming from the boost::io::quoted function. </p> <p> boost\io\detail\quoted_manip.hpp </p> <p> <em> extractor for non-const std::basic_string&amp; proxies template &lt;class Char, class Traits, class Alloc&gt; std::basic_istream&lt;Char, Traits&gt;&amp; operator&gt;&gt;(std::basic_istream&lt;Char, Traits&gt;&amp; is, </em></p> <blockquote> <p> const quoted_proxy&lt;std::basic_string&lt;Char, Traits, Alloc&gt;&amp;, Char&gt;&amp; proxy) </p> <blockquote> <p> { </p> <blockquote> <p> Char c; is &gt;&gt; c; if (c != proxy.delim) { </p> <blockquote> <p> proxy.string = c; is &gt;&gt; proxy.string; return is; </p> </blockquote> <p> } proxy.string.clear(); { </p> <blockquote> <p> boost::io::ios_flags_saver ifs(is); is &gt;&gt; std::noskipws; for (;;) { </p> <blockquote> <p> is &gt;&gt; c; if (!is.good()) <em> cope with I/O errors or end-of-file </em></p> <blockquote> <p> break; </p> </blockquote> <p> if (c == proxy.escape) { </p> <blockquote> <p> is &gt;&gt; c; if (!is.good()) <em> cope with I/O errors or end-of-file </em></p> <blockquote> <p> break; </p> </blockquote> </blockquote> <p> } else if (c == proxy.delim) </p> <blockquote> <p> break; </p> </blockquote> <p> proxy.string += c; </p> </blockquote> <p> } </p> </blockquote> <p> } return is; </p> </blockquote> <p> } </p> </blockquote> </blockquote> <p> The function is checking if the first character in the stream is a double quote, if it is all works fine. However if its not it assigns the value of the first character to the proxy.string and then uses the insertion operator to get the rest of the characters. However the insertion is not an append it is an assignment so the effect is the first character is lost. I'm not exactly sure if this is expected behavior of this function of not. A workaround is to change the proxy.string = c; to is.unget(); This will preserve the first character. </p> </description> <category>Ticket</category> </item> <item> <author>Richard Hazlewood <boost@…></author> <pubDate>Mon, 01 Nov 2010 21:45:57 GMT</pubDate> <title>version, component changed; owner set https://svn.boost.org/trac10/ticket/4716#comment:2 https://svn.boost.org/trac10/ticket/4716#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Beman Dawes</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.44.0</span> → <span class="trac-field-new">Boost 1.45.0</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">filesystem</span> </li> </ul> <p> This appears to have been addressed on the trunk, please can we ensure this makes it to the next (1.45) release? </p> <p> <a class="ext-link" href="http://lists.boost.org/boost-commit/2010/08/27576.php"><span class="icon">​</span>http://lists.boost.org/boost-commit/2010/08/27576.php</a> </p> <p> I know this is not specifically a filesystem issue, however, AFAIK fs is the only 'client' at the moment. </p> Ticket Richard Hazlewood <boost@…> Mon, 01 Nov 2010 21:46:29 GMT version changed https://svn.boost.org/trac10/ticket/4716#comment:3 https://svn.boost.org/trac10/ticket/4716#comment:3 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.45.0</span> → <span class="trac-field-new">Boost 1.44.0</span> </li> </ul> Ticket anonymous Fri, 14 Jan 2011 19:28:00 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4716#comment:4 https://svn.boost.org/trac10/ticket/4716#comment:4 <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> <p> Merged to release, revision 68159 </p> <p> Let me know if this doesn't solve the problems. </p> <p> Thanks, </p> <p> --Beman </p> Ticket