diff options
author | Lenny Maiorani <lenny@colorado.edu> | 2021-07-25 15:05:48 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-03 10:46:43 +0200 |
commit | 97bd13264ab0cb55607acf7887d4df5f216765bb (patch) | |
tree | 6ae20d0ebc0579f6c005c26bb7ec1e61676ba8a1 /AK | |
parent | 2c042e35300092886543d128c26af418f8bb0e06 (diff) | |
download | serenity-97bd13264ab0cb55607acf7887d4df5f216765bb.zip |
Everywhere: Make use of container version of all_of
Problem:
- New `all_of` implementation takes the entire container so the user
does not need to pass explicit begin/end iterators. This is unused
except is in tests.
Solution:
- Make use of the new and more user-friendly version where possible.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/CheckedFormatString.h | 3 | ||||
-rw-r--r-- | AK/MACAddress.h | 2 | ||||
-rw-r--r-- | AK/StringUtils.cpp | 2 | ||||
-rw-r--r-- | AK/UUID.cpp | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/AK/CheckedFormatString.h b/AK/CheckedFormatString.h index b08e4d12ad..bffce42202 100644 --- a/AK/CheckedFormatString.h +++ b/AK/CheckedFormatString.h @@ -199,8 +199,7 @@ private: return false; }; auto references_all_arguments = AK::all_of( - all_parameters.begin(), - all_parameters.end(), + all_parameters, [&](auto& entry) { return contains( check.used_arguments.begin(), diff --git a/AK/MACAddress.h b/AK/MACAddress.h index 155d9500fc..27ae58909c 100644 --- a/AK/MACAddress.h +++ b/AK/MACAddress.h @@ -81,7 +81,7 @@ public: constexpr bool is_zero() const { - return all_of(m_data.begin(), m_data.end(), [](const auto octet) { return octet == 0; }); + return all_of(m_data, [](const auto octet) { return octet == 0; }); } void copy_to(Bytes destination) const diff --git a/AK/StringUtils.cpp b/AK/StringUtils.cpp index 79ee530309..2c99617848 100644 --- a/AK/StringUtils.cpp +++ b/AK/StringUtils.cpp @@ -284,7 +284,7 @@ bool contains(const StringView& str, const StringView& needle, CaseSensitivity c bool is_whitespace(const StringView& str) { - return all_of(str.begin(), str.end(), is_ascii_space); + return all_of(str, is_ascii_space); } StringView trim(const StringView& str, const StringView& characters, TrimMode mode) diff --git a/AK/UUID.cpp b/AK/UUID.cpp index 839bffeb0f..1234c29ad3 100644 --- a/AK/UUID.cpp +++ b/AK/UUID.cpp @@ -70,7 +70,7 @@ bool UUID::operator==(const UUID& other) const bool UUID::is_zero() const { - return all_of(m_uuid_buffer.begin(), m_uuid_buffer.end(), [](const auto octet) { return octet == 0; }); + return all_of(m_uuid_buffer, [](const auto octet) { return octet == 0; }); } } |