From cb11081a7dbdcc0dcdeb7e04ce18521b010422f7 Mon Sep 17 00:00:00 2001
From: Beman The class The These semantics are useful for operating on paths that do not currently exist
+or on paths generated by operational non-member functions that resolve symlinks. Returns: A path with the same elements as Remarks: Uses [Example: All of the above asserts would succeed. On Windows, the
+returned path's separators would be backslashes rather than slashes, but that
+does not affect equality. —end example] Returns: Remarks: Uses Remarks: Uses [Note: Use the non-member operational function [Note: Use the [Example: All of the above asserts would succeed. On Windows, the
+returned path's separators would be backslashes rather than slashes, but that
+does not affect equality. —end example] If Otherwise, Remarks: An implementation may use iteration
+rather than recursion. Throws: As specified in Error reporting. Returns: Throws: As specified in Error reporting. Returns: Throws: As specified in Error reporting. Effects: Creates a temporary object Returns: Remarks: Names Returns: Throws: As specified in Error reporting. [Note: For two paths For two paths New class path member functions
-path normal_relative and
-relative member functions perform lexical processing only, and so do not
-follow symlinks. For existing path, or partially existing paths, that may
-contain symlinks use the relative operational functions which do
+normal and
+relative member functions, like all member functions of class path, perform lexical processing
+only. They do not
follow symlinks.path normal_relative(const path& base) const;
+path normal() const;
- Returns:
+normal(*this).relative(normal(base)).*this
+except that redundant current (dot) directory and name element followed
+by parent (dot-dot) directory elements are removed. If the returned path
+would otherwise be empty, a path containing a single current (dot)
+directory is returned.operator/= to compose the returned path.assert(path("foo/./bar/..").normal() == path("foo");
+assert(path("foo/./bar/../").normal() == path("foo/.");path relative(const path& base) const;
+path relative(const path& base) const;
- path() if the first mismatched element of
+ path() if the first mismatched element of
*this is equal to begin() and the first mismatched element
of base is equal to base.begin(), or
path(".") if the first mismatched element of
+ path(".") if the first mismatched element of
*this is equal to end() and the first mismatched element
of base is equal to base.end(), or
operator/= for each element in the sequence
[first mismatched element of p, p.end()).std::mismatch(begin(), end(),
+ std::mismatch(begin(), end(),
base.begin(), base.end()) to determine the first mismatched element.
- Path equality is determined by operator==.operator==. Uses operator/=
+ to compose the returned path.relative
+ if symlink following semantics are desired. —end note]normal function to preprocess . —end note]assert(path("/a/d").relative("/a/b/c") == path("../../d"));
+assert(path("/a/b/c").relative("/a/d") == path("../b/c"));
+assert(path("a/b/c").relative("a") == path("b/c"));
+assert(path("a/b/c").relative("a/b/c/x/y") == path("../.."));
+assert(path("a/b/c").relative("a/b/c") == path("."));New operational functions
path weakly_canonical(const path& p);
-path weakly_canonical(const path& p, system::error_code& ec)
-
+path weakly_canonical(const path& p, system::error_code& ec);
+
+Returns:
+
+exists(p), canonical(p)
+ p.parent_path().empty().
+ ? p
+ : weakly_canonical(p.parent_path()) / p.filename()path relative(const path& p, system::error_code& ec);
-relative(p, current_path(), ec).path relative(const path& p, const path& base=current_path());
+path relative(const path& p, const path& base=current_path());
+path relative(const path& p, const path& base, system::error_code& ec);
-
-weakly_canonical(p).relative(weakly_canonical(base)).path relative(const path& p, const path& base, system::error_code& ec);
-
-
-
path wc_base
-with a value of weakly_canonical(base, ec) and, if no
-error occurred, creates another temporary object path wc_p
-with a value of weakly_canonical(p, ec).wc_p.relative(wc_base) if no error
-occurred during processing of Effects, otherwise path().wc_base and wc_p
-are for exposition only. These names are not exposed to callers of
-relative.weakly_canonical(p[, ec]).relative(weakly_canonical(base[,
+ec])). The second form returns
+path() if an error occurs.a and b that both exist,
+ relative(a, b) is equivalent
+ to canonical(a).relative(canonical(b)). a and b neither of which exist,
+ relative(a, b) is equivalent
+ to a.relative(b). —end note]
@@ -122,7 +159,7 @@ relative.
Distributed under the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt
Revised -11 August 2015
+12 August 2015