This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.
directory_entry
comparisons are membersSection: 31.12.10.4 [fs.dir.entry.obs] Status: NAD Submitter: Ville Voutilainen Opened: 2016-08-03 Last modified: 2017-03-19
Priority: 2
View all other issues in [fs.dir.entry.obs].
View all issues with NAD status.
Discussion:
The comparison operators for directory_entry
are member functions
(31.12.10.4 [fs.dir.entry.obs]).
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 (31.12.6.8 [fs.path.nonmember]).
The meta-p/r is to turn the directory_entry
comparisons into non-member functions.
[2016-08 Chicago]
Wed PM: Priority 2
[2016-10-05 Ville provides concrete wording]
[2016-10 Telecon]
This (comparing a path
with a directory_entry
) works today w/o any changes. Closing as NAD.
Proposed resolution:
This wording is relative to N4606.
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; }
In 31.12.10.4 [fs.dir.entry.obs]/6-11, edit as follows:
bool operator==(const directory_entry& lhs, const directory_entry& rhs)constnoexcept;-6- Returns:
.
pathobjectlhs.path() == rhs.pathobjectpath()bool operator!=(const directory_entry& lhs, const directory_entry& rhs)constnoexcept;-7- Returns::
.
pathobjectlhs.path() != rhs.pathobjectpath()bool operator< (const directory_entry& lhs, const directory_entry& rhs)constnoexcept;-8- Returns::
.
pathobjectlhs.path() < rhs.pathobjectpath()bool operator<<=(const directory_entry& lhs, const directory_entry& rhs)constnoexcept;-9- Returns::
.
pathobjectlhs.path() <= rhs.pathobjectpath()bool operator> (const directory_entry& lhs, const directory_entry& rhs)constnoexcept;-10- Returns::
.
pathobjectlhs.path() > rhs.pathobjectpath()bool operator>=(const directory_entry& lhs, const directory_entry& rhs)constnoexcept;-11- Returns::
.
pathobjectlhs.path() >= rhs.pathobjectpath()