std::experimental::filesystem::equivalent

From cppreference.com
< cpp‎ | experimental‎ | fs
Defined in header <experimental/filesystem>
bool equivalent( const path& p1, const path& p2 );
(1) (filesystem TS)
bool equivalent( const path& p1, const path& p2, error_code& ec );
(2) (filesystem TS)

Checks whether the paths p1 and p2 refer to the same file or directory.

Internally, the function checks whether the paths have the same file status and resolve to the same file system entity, i.e. are on the same physical device at the same location.

The second version sets ec to an appropriate error code and returns false if an error occurs. Otherwise, ec is cleared with a call to ec.clear().

Contents

[edit] Parameters

p1, p2 - paths to check for equivalence
ec - error code to store error status to

[edit] Return value

true if the paths refer to the same file or directory.

[edit] Exceptions

1) filesystem_error if
  • neither of the paths resolve to an existing file
  • both paths resolve to a file of type other
  • other error occurs
2)
noexcept specification:  
noexcept
  

[edit] See also