diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-21 17:13:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-21 17:13:15 +0200 |
commit | ae19570ed0194d1cdcfafe83286c2238e86d37f3 (patch) | |
tree | 8393b7775abf8a88e644ba2122247c935d0aba71 | |
parent | d38ae1f987b5ccdb316fb044c35486ec3be6c029 (diff) |
Add support for moving the underlying string out of path
-rw-r--r-- | butl/path | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -438,6 +438,8 @@ namespace butl return string_type (*p_, b_, (e_ != string_type::npos ? e_ - b_ : e_)); } + pointer operator-> () const = delete; + friend bool operator== (const iterator& x, const iterator& y) { @@ -532,10 +534,13 @@ namespace butl public: const string_type& - string () const - { - return this->path_; - } + string () const& {return this->path_;} + + // Moves the underlying path string out of the path object. The + // path object becomes empty. Usage: std::move (p).string (). + // + string_type + string () && {string_type r; r.swap (this->path_); return r;} // If possible, return a POSIX representation of the path. For example, // for a Windows path in the form foo\bar this function will return |