31 Input/output library [input.output]

31.12 File systems [filesystems]

31.12.6 Class path [fs.class.path]

31.12.6.5 Members [fs.path.member]

31.12.6.5.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));