mirror of
https://github.com/esphome/esphome.git
synced 2026-09-14 08:38:39 +00:00
[core] Add const to string specialization optional_value/value_or
This commit is contained in:
@@ -289,13 +289,13 @@ template<typename... X> class TemplatableValue<std::string, X...> {
|
||||
}
|
||||
}
|
||||
|
||||
optional<std::string> optional_value(X... x) {
|
||||
optional<std::string> optional_value(X... x) const {
|
||||
if (!this->has_value())
|
||||
return {};
|
||||
return this->value(x...);
|
||||
}
|
||||
|
||||
std::string value_or(X... x, std::string default_value) {
|
||||
std::string value_or(X... x, std::string default_value) const {
|
||||
if (!this->has_value())
|
||||
return default_value;
|
||||
return this->value(x...);
|
||||
|
||||
Reference in New Issue
Block a user