[fs.op.equivalent]

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

## 31.12 File systems [[filesystems]](filesystems#fs.op.equivalent)

### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.equivalent)

#### 31.12.13.13 Equivalent [fs.op.equivalent]

[ð](#lib:equivalent)

`bool filesystem::equivalent(const path& p1, const path& p2);
bool filesystem::equivalent(const path& p1, const path& p2, error_code& ec) noexcept;
`

[1](#1)

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

Two paths are considered to resolve to the same file system entity if two
 candidate entities reside on the same device at the same location[.](#1.sentence-1)

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

On POSIX platforms, this is
 determined as if by the values of the POSIX stat class,
 obtained as if by stat for the two paths, having equal st_dev values
 and equal st_ino values[.](#1.sentence-2)

â *end note*]

[2](#2)

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

*Returns*: true, if p1 and p2 resolve to the same file
 system entity, otherwise false[.](#2.sentence-1)

The signature with argument ec returns false if an error occurs[.](#2.sentence-2)

[3](#3)

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

*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)

[4](#4)

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

*Remarks*: !exists(p1) || !exists(p2) is an error[.](#4.sentence-1)
