mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Simplified ranges::find_if with ranges::any_of and ranges::none_of.
This commit is contained in:
@@ -51,11 +51,11 @@ std::optional<QColor> MaybeColorFromSerialized(quint32 serialized) {
|
||||
std::optional<QColor> ColorFromString(const QString &string) {
|
||||
if (string.size() != 6) {
|
||||
return {};
|
||||
} else if (ranges::find_if(string, [](QChar ch) {
|
||||
} else if (ranges::any_of(string, [](QChar ch) {
|
||||
return (ch < 'a' || ch > 'f')
|
||||
&& (ch < 'A' || ch > 'F')
|
||||
&& (ch < '0' || ch > '9');
|
||||
}) != string.end()) {
|
||||
})) {
|
||||
return {};
|
||||
}
|
||||
const auto component = [](const QString &text, int index) {
|
||||
|
Reference in New Issue
Block a user