File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 55#include < filesystem>
66#include < string_view>
77#include < system_error>
8+ #include < utility>
89
910namespace tmp {
1011namespace {
@@ -100,7 +101,7 @@ directory::operator const fs::path&() const noexcept {
100101}
101102
102103const fs::path& directory::path () const noexcept {
103- return * this ;
104+ return pathobject ;
104105}
105106
106107fs::path directory::operator /(std::string_view source) const {
@@ -124,16 +125,13 @@ directory::~directory() noexcept {
124125}
125126
126127directory::directory (directory&& other) noexcept
127- : pathobject(std::move(other.pathobject)) {
128- other.pathobject .clear ();
129- }
128+ : pathobject(std::exchange(other.pathobject, fs::path())) {}
130129
131130directory& directory::operator =(directory&& other) noexcept {
131+ // TODO: should this throw in case of remove error?
132132 remove (*this );
133133
134- pathobject = std::move (other.pathobject );
135- other.pathobject .clear ();
136-
134+ pathobject = std::exchange (other.pathobject , fs::path ());
137135 return *this ;
138136}
139137} // namespace tmp
You can’t perform that action at this time.
0 commit comments