mirror of
https://github.com/esphome/esphome.git
synced 2025-04-19 01:00:28 +01:00
parent
39f3f795e2
commit
e3d673d16c
@ -293,7 +293,7 @@ std::string str_sanitize(const std::string &str) {
|
|||||||
std::replace_if(
|
std::replace_if(
|
||||||
out.begin(), out.end(),
|
out.begin(), out.end(),
|
||||||
[](const char &c) {
|
[](const char &c) {
|
||||||
return !(c == '-' || c == '_' || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
|
return c != '-' && c != '_' && (c < '0' || c > '9') && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z');
|
||||||
},
|
},
|
||||||
'_');
|
'_');
|
||||||
return out;
|
return out;
|
||||||
|
@ -59,7 +59,7 @@ template<typename T> class optional { // NOLINT
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(optional &rhs) {
|
void swap(optional &rhs) noexcept {
|
||||||
using std::swap;
|
using std::swap;
|
||||||
if (has_value() && rhs.has_value()) {
|
if (has_value() && rhs.has_value()) {
|
||||||
swap(**this, *rhs);
|
swap(**this, *rhs);
|
||||||
@ -206,7 +206,7 @@ template<typename T, typename U> inline bool operator>=(U const &v, optional<T>
|
|||||||
|
|
||||||
// Specialized algorithms
|
// Specialized algorithms
|
||||||
|
|
||||||
template<typename T> void swap(optional<T> &x, optional<T> &y) { x.swap(y); }
|
template<typename T> void swap(optional<T> &x, optional<T> &y) noexcept { x.swap(y); }
|
||||||
|
|
||||||
// Convenience function to create an optional.
|
// Convenience function to create an optional.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user