29 Input/output library [input.output]

29.11 File systems [filesystems]

29.11.7 Class path [fs.class.path]

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

void swap(path& lhs, path& rhs) noexcept;
Effects: Equivalent to lhs.swap(rhs).
size_t hash_value (const path& p) noexcept;
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;
Returns: !(lhs < rhs) && !(rhs < lhs).
[โ€‰Note
:
Path equality and path equivalence have different semantics.
  • Equality is determined by the path non-member operator==, which considers the two paths' lexical representations only.
    [โ€‰Example
    :
    path("foo") == "bar" is never true.
    โ€”โ€‰end example
    โ€‰]
  • 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
    :
    equivalent("foo", "bar") will be true when both paths resolve to the same file.
    โ€”โ€‰end example
    โ€‰]
Programmers wishing to determine if two paths are โ€œthe sameโ€ must decide if โ€œthe sameโ€ means โ€œthe same representationโ€ or โ€œresolve to the same actual fileโ€, and choose the appropriate function accordingly.
โ€”โ€‰end note
โ€‰]
friend bool operator!=(const path& lhs, const path& rhs) noexcept;
Returns: !(lhs == rhs).
friend bool operator< (const path& lhs, const path& rhs) noexcept;
Returns: lhs.compare(rhs) < 0.
friend bool operator<=(const path& lhs, const path& rhs) noexcept;
Returns: !(rhs < lhs).
friend bool operator> (const path& lhs, const path& rhs) noexcept;
Returns: rhs < lhs.
friend bool operator>=(const path& lhs, const path& rhs) noexcept;
Returns: !(lhs < rhs).
friend path operator/ (const path& lhs, const path& rhs);
Effects: Equivalent to: return path(lhs) /= rhs;