File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,15 @@ class path {
127127 // / Assign @a p as the path.
128128 self_type &operator =(std::string_view p);
129129
130+ // / Assign @a s as the path.
131+ self_type &operator =(std::string const & s);
132+
133+ // / Move @a s to be the path.
134+ self_type &operator =(std::string && s);
135+
136+ // / Copy @a s as the path.
137+ self_type &operator =(char const * s);
138+
130139 /* * Append or replace path with @a that.
131140 *
132141 * If @a that is absolute, it replaces @a this. Otherwise @a that is appended with exactly one
@@ -368,6 +377,24 @@ path::operator=(std::string_view p) {
368377 return *this ;
369378}
370379
380+ inline path &
381+ path::operator =(std::string const & s) {
382+ _path.assign (s);
383+ return *this ;
384+ }
385+
386+ inline path &
387+ path::operator =(std::string && s) {
388+ _path.assign (std::move (s));
389+ return *this ;
390+ }
391+
392+ inline path &
393+ path::operator =(char const * s) {
394+ _path.assign (s);
395+ return *this ;
396+ }
397+
371398inline char const *
372399path::c_str () const {
373400 return _path.c_str ();
Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ TEST_CASE("swoc_file", "[libswoc][swoc_file]") {
7474 [[maybe_unused]] auto mtime = file::last_write_time (s1, ec);
7575 REQUIRE (ec.value () != 0 );
7676
77+ fp = s1; // Make sure this isn't ambiguous
78+
7779 // Verify path can be used as a hashed key for STL containers.
7880 [[maybe_unused]] std::unordered_map<file::path, std::string> container;
7981}
You can’t perform that action at this time.
0 commit comments