Subject: [Boost-bugs] [Boost C++ Libraries] #7535: filesystem::path::iterator inconsistency with multiple leading separators
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-19 19:31:16
#7535: filesystem::path::iterator inconsistency with multiple leading separators
----------------------------------------------------+-----------------------
Reporter: Stefan GroÃe Pawig <boost@â¦> | Owner: bemandawes
Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
Version: Boost 1.51.0 | Severity: Problem
Keywords: |
----------------------------------------------------+-----------------------
Iterating backwards through a filesystem::path does not terminate at
path::begin() if the path starts with several leading directory
separators.
For example:
{{{
#include <boost/filesystem.hpp>
#include <iostream>
int main()
{
boost::filesystem::path p("/////foo");
boost::filesystem::path::iterator i = p.begin();
++i;
--i;
std::cout << ((i == p.begin()) ? "same" : "different") << std::endl;
}
}}}
Expected output: `same` \\
Actual output: `different`
Looking at the source (filesystem/src/path.cpp), it seems that in
path::begin() the iterator's m_pos member is set to the position of the
last leading directory separator.
During backward iteration, m_pos is set to 0, though, so the iterator
comparison (which involves comparing the m_pos members) yields false.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7535> 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:10 UTC