From f0935c0a7055300a42a3e0418e9910fecff2ccb8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 28 Mar 2016 09:06:26 +0200 Subject: Add basic_path::compare() --- butl/path | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'butl') diff --git a/butl/path b/butl/path index 1fdc8b6..ca94957 100644 --- a/butl/path +++ b/butl/path @@ -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 + int + compare (const basic_path& x) const { + return traits::compare (this->path_, x.path_);} public: const string_type& @@ -602,6 +589,27 @@ namespace butl return r; } + template + inline bool + operator== (const basic_path& x, const basic_path& y) + { + return x.compare (y) == 0; + } + + template + inline bool + operator!= (const basic_path& x, const basic_path& y) + { + return !(x == y); + } + + template + inline bool + operator< (const basic_path& x, const basic_path& y) + { + return x.compare (y) < 0; + } + // Additional operators for certain path kind combinations. // template -- cgit v1.1