Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WString: mark move ctor as noexcept #7610

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cores/esp8266/WString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ String::String(const __FlashStringHelper *pstr) {
}

#ifdef __GXX_EXPERIMENTAL_CXX0X__
String::String(String &&rval) {
String::String(String &&rval) noexcept {
init();
move(rval);
}

String::String(StringSumHelper &&rval) {
String::String(StringSumHelper &&rval) noexcept {
init();
move(rval);
}
Expand Down Expand Up @@ -224,7 +224,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length) {
}

#ifdef __GXX_EXPERIMENTAL_CXX0X__
void String::move(String &rhs) {
void String::move(String &rhs) noexcept {
if (buffer()) {
if (capacity() >= rhs.len()) {
memmove_P(wbuffer(), rhs.buffer(), rhs.length() + 1);
Expand Down Expand Up @@ -267,13 +267,13 @@ String & String::operator =(const String &rhs) {
}

#ifdef __GXX_EXPERIMENTAL_CXX0X__
String & String::operator =(String &&rval) {
String & String::operator =(String &&rval) noexcept {
if (this != &rval)
move(rval);
return *this;
}

String & String::operator =(StringSumHelper &&rval) {
String & String::operator =(StringSumHelper &&rval) noexcept {
if (this != &rval)
move(rval);
return *this;
Expand Down
10 changes: 5 additions & 5 deletions cores/esp8266/WString.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class String {
String(const String &str);
String(const __FlashStringHelper *str);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
String(String &&rval);
String(StringSumHelper &&rval);
String(String &&rval) noexcept;
String(StringSumHelper &&rval) noexcept;
#endif
explicit String(char c);
explicit String(unsigned char, unsigned char base = 10);
Expand Down Expand Up @@ -96,8 +96,8 @@ class String {
String & operator =(const char *cstr);
String & operator = (const __FlashStringHelper *str);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
String & operator =(String &&rval);
String & operator =(StringSumHelper &&rval);
String & operator =(String &&rval) noexcept;
String & operator =(StringSumHelper &&rval) noexcept;
#endif

// concatenate (works w/ built-in types)
Expand Down Expand Up @@ -317,7 +317,7 @@ class String {
String & copy(const char *cstr, unsigned int length);
String & copy(const __FlashStringHelper *pstr, unsigned int length);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void move(String &rhs);
void move(String &rhs) noexcept;
#endif
};

Expand Down