[fs.path.nonmember]

# 31 Input/output library [[input.output]](./#input.output)

## 31.12 File systems [[filesystems]](filesystems#fs.path.nonmember)

### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.nonmember)

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

[ð](#lib:swap,path)

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

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15393)

*Effects*: Equivalent to lhs.swap(rhs)[.](#1.sentence-1)

[ð](#lib:hash_value,path)

`size_t hash_value(const path& p) noexcept;
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15404)

*Returns*: A hash value for the path p[.](#2.sentence-1)

If
 for two paths, p1 == p2 then hash_value(p1) == hash_value(p2)[.](#2.sentence-2)

[ð](#lib:operator==,path)

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

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15416)

*Returns*: lhs.compare(rhs) == 0[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15421)

[*Note [1](#note-1)*:

Path equality and path equivalence have different semantics[.](#4.sentence-1)

- [(4.1)](#4.1)

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

- [(4.2)](#4.2)

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

â *end note*]

[ð](#lib:operator%3c=%3e,path)

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

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15445)

*Returns*: lhs.compare(rhs) <=> 0[.](#5.sentence-1)

[ð](#lib:operator/,path)

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

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15456)

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