-
Notifications
You must be signed in to change notification settings - Fork 13.3k
WString: remove operator==(const __FlashStringHelper*) #8569
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
Changes from 5 commits
e15fc91
a5cc344
e4b47bc
a02c21c
bc52bd6
b912a70
65ad698
fb666ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,10 +211,9 @@ class String { | |
return *this; | ||
} | ||
|
||
// checks whether the internal buffer pointer is set. | ||
// (should not be the case for us, since we always reset the pointer to the SSO buffer instead of setting it to nullptr) | ||
// checks whether the String is empty | ||
explicit operator bool() const { | ||
return buffer() != nullptr; | ||
return length() != 0; | ||
} | ||
|
||
int compareTo(const String &s) const; | ||
|
@@ -230,6 +229,13 @@ class String { | |
bool operator ==(const __FlashStringHelper *rhs) const { | ||
return equals(rhs); | ||
} | ||
bool operator ==(std::nullptr_t) const { | ||
return length() == 0; | ||
} | ||
d-a-v marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[[deprecated("use nullptr instead of NULL")]] | ||
bool operator ==(decltype(NULL)) const { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just note that the trade-off is someone will write There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that I reverted: We still have this: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think they refer to some old version of GCC (pre 4.6?) with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only one I could find that is installed on my workstation and probably rarely used(*). (*)given There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we could've had this But, newlib overrides it edit: ...need to check the preprocessor chain, though, but I would guess it overrides it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, glibc code requesting it |
||
return length() == 0; | ||
} | ||
bool operator !=(const String &rhs) const { | ||
return !equals(rhs); | ||
} | ||
|
@@ -239,6 +245,13 @@ class String { | |
bool operator !=(const __FlashStringHelper *rhs) const { | ||
return !equals(rhs); | ||
} | ||
bool operator !=(std::nullptr_t) const { | ||
return length() != 0; | ||
} | ||
[[deprecated("use nullptr instead of NULL")]] | ||
bool operator !=(decltype(NULL)) const { | ||
return length() != 0; | ||
} | ||
bool operator <(const String &rhs) const; | ||
bool operator >(const String &rhs) const; | ||
bool operator <=(const String &rhs) const; | ||
|
Uh oh!
There was an error while loading. Please reload this page.