diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-03-28 09:06:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-03-28 09:06:26 +0200 |
commit | f0935c0a7055300a42a3e0418e9910fecff2ccb8 (patch) | |
tree | 569d32077d845f901f20b245c91360a7c9447c6a | |
parent | 424396e5e7ed1463659bf683c47c837de15ccef0 (diff) |
Add basic_path::compare()
-rw-r--r-- | butl/path | 42 |
1 files changed, 25 insertions, 17 deletions
@@ -535,23 +535,10 @@ namespace butl // Note that comparison is case-insensitive if the filesystem is // not case-sensitive (e.g., Windows). // - bool - operator== (basic_path const& x) const - { - return traits::compare (this->path_, x.path_) == 0; - } - - bool - operator!= (basic_path const& x) const - { - return !(*this == x); - } - - bool - operator< (basic_path const& x) const - { - return traits::compare (this->path_, x.path_) < 0; - } + template <typename K1> + int + compare (const basic_path<C, K1>& x) const { + return traits::compare (this->path_, x.path_);} public: const string_type& @@ -602,6 +589,27 @@ namespace butl return r; } + template <typename C, typename K1, typename K2> + inline bool + operator== (const basic_path<C, K1>& x, const basic_path<C, K2>& y) + { + return x.compare (y) == 0; + } + + template <typename C, typename K1, typename K2> + inline bool + operator!= (const basic_path<C, K1>& x, const basic_path<C, K2>& y) + { + return !(x == y); + } + + template <typename C, typename K1, typename K2> + inline bool + operator< (const basic_path<C, K1>& x, const basic_path<C, K2>& y) + { + return x.compare (y) < 0; + } + // Additional operators for certain path kind combinations. // template <typename C> |