aboutsummaryrefslogtreecommitdiff
path: root/libbutl/path.mxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbutl/path.mxx')
-rw-r--r--libbutl/path.mxx29
1 files changed, 9 insertions, 20 deletions
diff --git a/libbutl/path.mxx b/libbutl/path.mxx
index 2374fb5..4ed6989 100644
--- a/libbutl/path.mxx
+++ b/libbutl/path.mxx
@@ -1382,35 +1382,24 @@ LIBBUTL_MODEXPORT namespace butl
using path_type = typename base::path_type;
using string_type = typename base::string_type;
+ path_type path;
+
explicit
basic_path_name_value (path_type p, optional<string_type> n = nullopt)
- : base (&path_, std::move (n)), path_ (std::move (p)) {}
-
- int
- compare (const basic_path_name_value& x) const
- {
- if (int r = path_.compare (x.path_))
- return r;
+ : base (&path, std::move (n)), path (std::move (p)) {}
- return this->name < x.name ? -1 : this->name > x.name ? 1 : 0;
- }
+ // Note that a NULL path is converted to empty path.
+ //
+ explicit
+ basic_path_name_value (const basic_path_name<P>& v)
+ : base (&path, v.name),
+ path (v.path != nullptr ? *v.path : path_type ()) {}
basic_path_name_value (basic_path_name_value&&);
basic_path_name_value (const basic_path_name_value&);
basic_path_name_value& operator= (basic_path_name_value&&);
basic_path_name_value& operator= (const basic_path_name_value&);
-
- private:
- P path_;
};
-
- template <typename P>
- inline bool
- operator< (const basic_path_name_value<P>& x,
- const basic_path_name_value<P>& y)
- {
- return x.compare (y) < 0;
- }
}
LIBBUTL_MODEXPORT namespace std