Skip to content

Commit

Permalink
Explicitly default CStringView copy-assignment (#235)
Browse files Browse the repository at this point in the history
This is good form, since the class has a user-declared copy constructor.
Without this, clang emits the following warning:

warning: definition of implicit copy assignment operator for 'CStringView'
is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]

Co-authored-by: Martijn Otto <[email protected]>
  • Loading branch information
omartijn and martijn-resolume authored Oct 26, 2021
1 parent 7870879 commit 72deea4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/vcpkg/base/cstringview.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace vcpkg
constexpr CStringView(const CStringView&) = default;
CStringView(const std::string& str) : cstr(str.c_str()) { }

CStringView& operator=(const CStringView& cstr) = default;

constexpr const char* c_str() const { return cstr; }

void to_string(std::string& str) const { str.append(cstr); }
Expand Down

0 comments on commit 72deea4

Please sign in to comment.