29 Input/output library [input.output]

29.11 File systems [filesystems]

29.11.7 Class path [fs.class.path]

29.11.7.4 Members [fs.path.member]

29.11.7.4.8 Compare [fs.path.compare]

int compare(const path& p) const noexcept;
Returns:
  • Let rootNameComparison be the result of this->root_­name().native().compare(p.root_­name().native()). If rootNameComparison is not 0, rootNameComparison.
  • Otherwise, if !this->has_­root_­directory() and p.has_­root_­directory(), a value less than 0.
  • Otherwise, if this->has_­root_­directory() and !p.has_­root_­directory(), a value greater than 0.
  • Otherwise, if native() for the elements of this->relative_­path() are lexicographically less than native() for the elements of p.relative_­path(), a value less than 0.
  • Otherwise, if native() for the elements of this->relative_­path() are lexicographically greater than native() for the elements of p.relative_­path(), a value greater than 0.
  • Otherwise, 0.
int compare(const string_type& s) const; int compare(basic_string_view<value_type> s) const; int compare(const value_type* s) const;
Effects: Equivalent to: return compare(path(s));