Files
2025-10-25 03:02:53 +03:00

1.8 KiB

[fs.path.compare]

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;

1

#

Returns:

  • (1.1)

    Let rootNameComparison be the result of this->root_name().native().compare(p.root_name().native()). If rootNameComparison is not 0, rootNameComparison.

  • (1.2)

    Otherwise, if !this->has_root_directory() and p.has_root_directory(), a value less than 0.

  • (1.3)

    Otherwise, if this->has_root_directory() and !p.has_root_directory(), a value greater than 0.

  • (1.4)

    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.

  • (1.5)

    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.

  • (1.6)

    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;

2

#

Effects: Equivalent to: return compare(path(s));