Subject: [Boost-bugs] [Boost C++ Libraries] #11898: Input stream operator of a filesystem::path can't handle spaces
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-01-09 20:40:57
#11898: Input stream operator of a filesystem::path can't handle spaces
------------------------------+------------------------
Reporter: anonymous | Owner: bemandawes
Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
Version: Boost 1.58.0 | Severity: Problem
Keywords: |
------------------------------+------------------------
The operator>> in filesystem::path breaks at spaces as it would for a
std::string, whereas spaces can be an integral part of a path. Concretely,
the following code
{{{
boost::filesystem::path p;
std::istringstream("path/with spaces") >> p;
std::cout << p << std::endl;
}}}
prints "path/with" on OS X 10.11.2. I believe boost::io::quoted is
supposed to take care of the spaces in the operator>> implementation
{{{
is >> boost::io::quoted(str, static_cast<Char>('&'));
}}}
but this doesn't work on my system. (One of the weird points seems to be
that it gets called with two arguments, but its declaration requires three
and I can't find a default argument declaration.) Replacing the
implementation with
{{{
std::getline(is, str);
}}}
seems to work for me, but I have a feeling that this bypasses some of the
necessary logic in boost::io::quoted.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11898> 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:19 UTC