This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
Section: 31.12.6 [fs.class.path] Status: Resolved Submitter: Billy O'Neal III Opened: 2016-11-10 Last modified: 2017-07-18
Priority: 2
View all other issues in [fs.class.path].
View all issues with Resolved status.
Discussion:
The explicit definition ofpath
in terms of a string
requires that the abstraction be leaky. Consider that
the meaning of the expression p += '/'
has very
different behavior in the case that p
is empty; that a
path
can uselessly contain null characters; and that
iterators must be constant to avoid having to reshuffle
the packed string.
Suggested resolution:
Define member functions to express apath
as a
string, but define its state in terms of the abstract
sequence of components (including the leading
special components) already described by the
iterator interface. Remove members that rely on
arbitrary manipulation of a string value.
[2016-11-12, Issaquah]
Sat PM: "Looks good"
[Issues Telecon 16-Dec-2016]
Priority 2; should be addressed by omnibus Filesystem paper.
[Kona, 2017-03]
This is resolved by p0492r2.
Proposed resolution:
This wording is relative to N4606.
Edit [fs.path.concat] as follows:
path& operator+=(const path& x); path& operator+=(const string_type& x); path& operator+=(basic_string_view<value_type> x); path& operator+=(const value_type * x); path& operator+=(value_type x); template <class Source> path& operator+=(const Source& x); template <class EcharT> path& operator+=(EcharT x); template <class Source> path& concat(const Source& x);template <class InputIterator> path& concat(InputIterator first, InputIterator last);-1-
Postcondition:native() == prior_native + effective-argument
, whereprior_native
isnative()
prior to the call tooperator+=
, andeffective-argument
is:
ifx
is present and isconst path&
,x.native()
; otherwise,ifsource
is present, the effective range ofsource
[ath.re]; otherwise,>iffirst
andlast
are present, the range[first, last)
; otherwise,x
.-2- Returns:
If the value type ofEffects: Equivalent toeffective-argument
would not bepath::value_type
, the acctual argument or argument range is first converted [ath.type.cv] so thateffective-argument
has value typepath::value_type
.pathname.append(path(x).native())
[Note: This directly manipulates the value ofnative()
and may not be portable between operating systems. — end note]*this
.template <class InputIterator> path& concat(InputIterator first, InputIterator last);-?- Effects: Equivalent to
-?- Returns:pathname.append(path(first, last).native())
[Note: This directly manipulates the value ofnative()
and may not be portable between operating systems. — end note]*this
.