Title
Questionable specification of path::operator/= and path::append
Status
c++17
Section
[fs.path.append]
Submitter
Tim Song

Created on 2016-06-14.00:00:00 last changed 81 months ago

Messages

Date: 2017-03-19.19:35:20

Proposed resolution:

This wording is relative to N4606.

  1. Edit [fs.path.append]/4-5 as indicated:

    template <class Source>
      path& operator/=(const Source& source);
    template <class Source>
      path& append(const Source& source);
    

    -?- Effects: Equivalent to return operator/=(path(source));.

    template <class InputIterator>
      path& append(InputIterator first, InputIterator last);
    

    -4- Effects: Equivalent to return operator/=(path(first, last));.Appends path::preferred_separator to pathname, converting format and encoding if required ([fs.path.cvt]), unless:

    1. — an added directory-separator would be redundant, or
    2. — an added directory-separator would change an relative path to an absolute path, or
    3. source.empty() is true, or
    4. *source.native().cbegin() is a directory-separator.

    Then appends the effective range of source ([fs.path.req]) or the range [first, last) to pathname, converting format and encoding if required ([fs.path.cvt]).

    -5- Returns: *this.

Date: 2017-03-19.19:35:20

[ 2016-08 Chicago ]

Wed AM: Move to Tentatively Ready

Friday AM, in discussing 2664 a comment about missing "equivalent to" language was made, so PR updated.

Previous Resolution [SUPERSEDED]

This wording is relative to N4594.

  1. Edit [fs.path.append]/4-5 as indicated:

    template <class Source>
      path& operator/=(const Source& source);
    template <class Source>
      path& append(const Source& source);
    

    -?- Effects: operator/=(path(source))

    -?- Returns: *this.

    template <class InputIterator>
      path& append(InputIterator first, InputIterator last);
    

    -4- Effects: Appends path::preferred_separator to pathname, converting format and encoding if required ([fs.path.cvt]), unless:

    • an added directory-separator would be redundant, or

    • an added directory-separator would change an relative path to an absolute path, or

    • source.empty() is true, or

    • *source.native().cbegin() is a directory-separator.

    Then appends the effective range of source ([fs.path.req]) or the range [first, last) to pathname, converting format and encoding if required ([fs.path.cvt])operator/=(path(first, last)).

    -5- Returns: *this.

Date: 2016-07-15.00:00:00

[ 2016-07-03, Daniel comments ]

The same wording area is affected by LWG 2664.

Date: 2017-03-19.19:35:20

The current specification of operator/= taking a const Source& parameter, and of path::append in [fs.path.append] appears to require Source to have a native() and an empty() member, and seemingly requires different behavior for append(empty_range) and append(first, last) when first == last (the last two bullet points being specified with source alone), which doesn't make any sense.

It appears that these overloads can just be specified using the operator/=(const path&) overload.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-11-14 03:59:28adminsetstatus: pending -> wp
2016-11-14 03:55:22adminsetstatus: ready -> pending
2016-08-04 02:52:49adminsetmessages: + msg8387
2016-08-04 02:52:49adminsetstatus: new -> ready
2016-07-03 12:47:54adminsetmessages: + msg8225
2016-07-03 12:16:07adminsetmessages: + msg8223
2016-06-14 00:00:00admincreate