<filesystem> operators

Visual Studio 2015
 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at <filesystem> operators.

The operators perform a lexical comparison of two paths as strings. Use the equivalent function to determine whether two paths (for example a relative path and an absolute path) refer to the same file or directory on disk.

C:\root> D:\root: false  
C:\root> C:\root\sub: false  
C:\root> C:\roo: true  

For more information, see File System Navigation (C++).

bool operator==(const path& left, const path& right) noexcept;  

The function returns left.native() == right.native().

bool operator!=(const path& left, const path& right) noexcept;  

The function returns !(left == right).

bool operator<(const path& left, const path& right) noexcept;  

The function returns left.native() < right.native().

bool operator<=(const path& left, const path& right) noexcept;  

The function returns !(right < left).

bool operator>(const path& left, const path& right) noexcept;  

The function returns right < left.

bool operator>=(const path& left, const path& right) noexcept;  

The function returns !(left < right).

path operator/(const path& left, const path& right);

The function executes:

basic_string<Elem, Traits> str;  
path ans = left;  
return (ans /= right);

template <class Elem, class Traits>  
basic_ostream<Elem, Traits>& operator<<(basic_ostream<Elem, Traits>& os, const path& pval);

The function returns os << pval.string<Elem, Traits>().

template <class Elem, class Traits>  
basic_istream<Elem, Traits>& operator<<(basic_istream<Elem, Traits>& is, const path& pval);

The function executes:

basic_string<Elem, Traits> str;  
is>> str;  
pval = str;  
return (is);

path Class (C++ Standard Template Library)
File System Navigation (C++)
<filesystem>

Show: