This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

2732. Questionable specification of path::operator/= and path::append

Section: 31.12.6.5.3 [fs.path.append] Status: C++17 Submitter: Tim Song Opened: 2016年06月14日 Last modified: 2017年07月30日

Priority: 2

View all other issues in [fs.path.append].

View all issues with C++17 status.

Discussion:

The current specification of operator/= taking a const Source& parameter, and of path::append in 31.12.6.5.3 [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.

[2016年07月03日, Daniel comments]

The same wording area is affected by LWG 2664 (i) .

[2016-08 Chicago]

Wed AM: Move to Tentatively Ready

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

Previous Resolution [SUPERSEDED]

This wording is relative to N4594.

  1. Edit 31.12.6.5.3 [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 (31.12.6.3 [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 (31.12.6.4 [fs.path.req]) or the range [first, last) to pathname, converting format and encoding if required (31.12.6.3 [fs.path.cvt]) (削除ここまで)(追記) operator/=(path(first, last)) (追記ここまで).

    -5- Returns: *this.

Proposed resolution:

This wording is relative to N4606.

  1. Edit 31.12.6.5.3 [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 (31.12.6.3 [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 (31.12.6.4 [fs.path.req]) or the range [first, last) to pathname, converting format and encoding if required (31.12.6.3 [fs.path.cvt]). (削除ここまで)

    (削除) -5- Returns: *this. (削除ここまで)

AltStyle によって変換されたページ (->オリジナル) /