Title
directory_entry comparisons are members
Status
nad
Section
[fs.dir.entry.obs]
Submitter
Ville Voutilainen

Created on 2016-08-03.00:00:00 last changed 90 months ago

Messages

Date: 2017-03-19.19:35:20

Proposed resolution:

This wording is relative to N4606.

  1. In [fs.class.directory_entry] synopsis, edit as follows:

    namespace std::filesystem {
    class directory_entry {
    public:
      […]
      bool operator< (const directory_entry& rhs) const noexcept;
      bool operator==(const directory_entry& rhs) const noexcept;
      bool operator!=(const directory_entry& rhs) const noexcept;
      bool operator<=(const directory_entry& rhs) const noexcept;
      bool operator> (const directory_entry& rhs) const noexcept;
      bool operator>=(const directory_entry& rhs) const noexcept;
    
    private:
      path pathobject; // exposition only
    };
    
    bool operator< (const directory_entry& lhs, const directory_entry& rhs) noexcept;
    bool operator==(const directory_entry& lhs, const directory_entry& rhs) noexcept;
    bool operator!=(const directory_entry& lhs, const directory_entry& rhs) noexcept;
    bool operator<=(const directory_entry& lhs, const directory_entry& rhs) noexcept;
    bool operator> (const directory_entry& lhs, const directory_entry& rhs) noexcept;
    bool operator>=(const directory_entry& lhs, const directory_entry& rhs) noexcept;
    
    }
    
  2. In [fs.dir.entry.obs]/6-11, edit as follows:

    bool operator==(const directory_entry& lhs, const directory_entry& rhs) const noexcept;
    

    -6- Returns: pathobjectlhs.path() == rhs.pathobjectpath().

    bool operator!=(const directory_entry& lhs, const directory_entry& rhs) const noexcept;
    

    -7- Returns:: pathobjectlhs.path() != rhs.pathobjectpath().

    bool operator< (const directory_entry& lhs, const directory_entry& rhs) const noexcept;
    

    -8- Returns:: pathobjectlhs.path() < rhs.pathobjectpath().

    bool operator<<=(const directory_entry& lhs, const directory_entry& rhs) const noexcept;
    

    -9- Returns:: pathobjectlhs.path() <= rhs.pathobjectpath().

    bool operator> (const directory_entry& lhs, const directory_entry& rhs) const noexcept;
    

    -10- Returns:: pathobjectlhs.path() > rhs.pathobjectpath().

    bool operator>=(const directory_entry& lhs, const directory_entry& rhs) const noexcept;
    

    -11- Returns:: pathobjectlhs.path() >= rhs.pathobjectpath().

Date: 2017-02-02.00:41:18

[ 2016-10 Telecon ]

This (comparing a path with a directory_entry) works today w/o any changes. Closing as NAD.

Date: 2016-10-05.00:00:00

[ 2016-10-05 Ville provides concrete wording ]

Date: 2016-08-04.03:06:12

[ 2016-08 Chicago ]

Wed PM: Priority 2

Date: 2017-03-19.19:35:20

The comparison operators for directory_entry are member functions ([fs.dir.entry.obs]).

That means that a directory_entry can be compared with a path, but a path cannot be compared with a directory_entry, because the left-hand side is not subject to conversions. This seems unfortunate.

Note that the comparisons for path are non-members ([fs.path.nonmember]).

The meta-p/r is to turn the directory_entry comparisons into non-member functions.

History
Date User Action Args
2016-10-10 20:46:47adminsetmessages: + msg8554
2016-10-10 20:46:47adminsetstatus: new -> nad
2016-10-06 19:11:58adminsetmessages: + msg8541
2016-10-06 19:11:58adminsetmessages: + msg8540
2016-08-04 03:06:12adminsetmessages: + msg8392
2016-08-03 00:00:00admincreate