Files
cppdraft_translate/cppdraft/fs/path/nonmember.md
2025-10-25 03:02:53 +03:00

2.5 KiB

[fs.path.nonmember]

31 Input/output library [input.output]

31.12 File systems [filesystems]

31.12.6 Class path [fs.class.path]

31.12.6.8 Non-member functions [fs.path.nonmember]

🔗

void swap(path& lhs, path& rhs) noexcept;

1

#

Effects: Equivalent to lhs.swap(rhs).

🔗

size_t hash_value(const path& p) noexcept;

2

#

Returns: A hash value for the path p.

If for two paths, p1 == p2 then hash_value(p1) == hash_value(p2).

🔗

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

3

#

Returns: lhs.compare(rhs) == 0.

4

#

[Note 1:

Path equality and path equivalence have different semantics.

  • (4.1)

    Equality is determined by the path non-member operator==, which considers the two paths' lexical representations only. [Example 1: path("foo") == "bar" is never true. — end example]

  • (4.2)

    Equivalence is determined by the equivalent() non-member function, which determines if two paths resolve ([fs.class.path]) to the same file system entity. [Example 2: equivalent("foo", "bar") will be true when both paths resolve to the same file. — end example]

— end note]

🔗

friend strong_ordering operator<=>(const path& lhs, const path& rhs) noexcept;

5

#

Returns: lhs.compare(rhs) <=> 0.

🔗

friend path operator/(const path& lhs, const path& rhs);

6

#

Effects: Equivalent to: return path(lhs) /= rhs;