Why is path comparison case sensitive in the latest file system (C ++) project?

Quote from Programming Languages ​​- C ++ - Technical specification of the N4100 file system :

8.4.8 pathcompare [path.compare]

1 int compare (const path & p) const noexcept;

2 Returns: the value is less than 0 if native () for elements from * is lexicographically less than native () for p elements, otherwise the value is greater than 0 if native () for elements * of this lexicographically more than native () for elements p, otherwise 0.

Why is file path comparison defined as case sensitive if there are file systems that are not case sensitive (NTFS, etc.)? Should the comparison be compared with specific file system rules?

+4
source share
1 answer

You also have the function equivalent()specified in 15.13, which checks if two paths to the same file are allowed.

bool equivalent(const path& p1, const path& p2)
  1. Returns: trueif s1 == s2and p1and p2allowed to the same file system object, the else false. A signature with an argument ecreturns falseif an error occurs.
Function

compare()will use iterators and path::operator==to compare elements. In 8.6.13 you wrote:

bool operator==(const path& lhs, const path& rhs) noexcept;
  1. Equivalence is determined by the equivalent () non-member function, which determines whether two paths allow the same file system object. So the equivalent ("foo", "bar") will be true when both paths are the same file

  2. , , "", , " " " " " ",

, equivalent() , compare() , " " .

+2

All Articles