From 860e6cf5cb7d96499aecf6f6067783bdb71c29ad Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:43:52 -0700 Subject: [PATCH] Modernize `std::all_of` with ranges In DITSpecification.cpp, MaterialAsset.cpp, and ShaderAsset.cpp, lambda predicates were replaced by pointers to member functions because ranges algorithms are able invoke those. In NetPlayClient.cpp, the non-trivial `NetPlay::Player` elements were being passed by value in `NetPlayClient::DoAllPlayersHaveGame()`. This has been fixed. In WIABlob.cpp, the second example's predicate was returning the `std::optional` by value instead of implicitly converting it to a bool. This has been fixed. --- Source/Core/Common/Crypto/ec.cpp | 2 +- Source/Core/Common/FatFsUtil.cpp | 2 +- Source/Core/Common/NandPaths.cpp | 5 ++--- Source/Core/Core/Core.cpp | 2 +- Source/Core/Core/IOS/Device.cpp | 4 ++-- Source/Core/Core/IOS/ES/Formats.cpp | 2 +- Source/Core/Core/IOS/ES/NandUtils.cpp | 2 +- Source/Core/Core/IOS/ES/TitleManagement.cpp | 2 +- Source/Core/Core/IOS/FS/HostBackend/FS.cpp | 3 +-- Source/Core/Core/Movie.cpp | 2 +- Source/Core/Core/NetPlayClient.cpp | 2 +- Source/Core/Core/NetPlayCommon.cpp | 2 +- Source/Core/Core/NetPlayServer.cpp | 10 ++++------ Source/Core/DiscIO/DiscUtils.cpp | 2 +- Source/Core/DiscIO/RiivolutionPatcher.cpp | 2 +- Source/Core/DiscIO/VolumeWad.cpp | 2 +- Source/Core/DiscIO/WIABlob.cpp | 6 +++--- Source/Core/DolphinQt/ConvertDialog.cpp | 6 +++--- Source/Core/DolphinQt/GameList/GameList.cpp | 8 ++++---- .../Settings/USBDeviceAddToWhitelistDialog.cpp | 2 +- .../InputCommon/ControlReference/ExpressionParser.cpp | 6 ++---- .../ControllerEmu/ControlGroup/IMUAccelerometer.cpp | 4 ++-- .../ControllerEmu/ControlGroup/IMUGyroscope.cpp | 4 ++-- .../InputCommon/ControllerInterface/MappingCommon.cpp | 2 +- .../DynamicInputTextures/DITSpecification.cpp | 3 +-- Source/Core/VideoCommon/Assets/MaterialAsset.cpp | 3 +-- Source/Core/VideoCommon/Assets/ShaderAsset.cpp | 3 +-- 27 files changed, 42 insertions(+), 51 deletions(-) diff --git a/Source/Core/Common/Crypto/ec.cpp b/Source/Core/Common/Crypto/ec.cpp index 1f1b0e6018..cdfe228f81 100644 --- a/Source/Core/Common/Crypto/ec.cpp +++ b/Source/Core/Common/Crypto/ec.cpp @@ -24,7 +24,7 @@ struct Elt { bool IsZero() const { - return std::all_of(data.begin(), data.end(), [](u8 b) { return b == 0; }); + return std::ranges::all_of(data, [](u8 b) { return b == 0; }); } void MulX() diff --git a/Source/Core/Common/FatFsUtil.cpp b/Source/Core/Common/FatFsUtil.cpp index ffac0fc6c9..3ad4fd9fb3 100644 --- a/Source/Core/Common/FatFsUtil.cpp +++ b/Source/Core/Common/FatFsUtil.cpp @@ -729,7 +729,7 @@ static bool Unpack(const std::function& cancelled, const std::string pat const bool is_path_traversal_attack = (childname.find("\\") != std::string_view::npos) || (childname.find('/') != std::string_view::npos) || - std::all_of(childname.begin(), childname.end(), [](char c) { return c == '.'; }); + std::ranges::all_of(childname, [](char c) { return c == '.'; }); if (is_path_traversal_attack) { ERROR_LOG_FMT( diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp index 789fc66b1f..35c5eac689 100644 --- a/Source/Core/Common/NandPaths.cpp +++ b/Source/Core/Common/NandPaths.cpp @@ -113,7 +113,7 @@ static bool IsIllegalCharacter(char c) std::string EscapeFileName(const std::string& filename) { // Prevent paths from containing special names like ., .., ..., ...., and so on - if (std::all_of(filename.begin(), filename.end(), [](char c) { return c == '.'; })) + if (std::ranges::all_of(filename, [](char c) { return c == '.'; })) return ReplaceAll(filename, ".", "__2e__"); // Escape all double underscores since we will use double underscores for our escape sequences @@ -170,8 +170,7 @@ std::string UnescapeFileName(const std::string& filename) bool IsFileNameSafe(const std::string_view filename) { - return !filename.empty() && - !std::all_of(filename.begin(), filename.end(), [](char c) { return c == '.'; }) && + return !filename.empty() && !std::ranges::all_of(filename, [](char c) { return c == '.'; }) && std::none_of(filename.begin(), filename.end(), IsIllegalCharacter); } } // namespace Common diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index bc6289af97..84a398b7f7 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -194,7 +194,7 @@ void DisplayMessage(std::string message, int time_in_ms) return; // Actually displaying non-ASCII could cause things to go pear-shaped - if (!std::all_of(message.begin(), message.end(), Common::IsPrintableCharacter)) + if (!std::ranges::all_of(message, Common::IsPrintableCharacter)) return; OSD::AddMessage(std::move(message), time_in_ms); diff --git a/Source/Core/Core/IOS/Device.cpp b/Source/Core/Core/IOS/Device.cpp index 3fdbcaed62..bf75bff1b5 100644 --- a/Source/Core/Core/IOS/Device.cpp +++ b/Source/Core/Core/IOS/Device.cpp @@ -98,8 +98,8 @@ bool IOCtlVRequest::HasNumberOfValidVectors(const size_t in_count, const size_t return false; auto IsValidVector = [](const auto& vector) { return vector.size == 0 || vector.address != 0; }; - return std::all_of(in_vectors.begin(), in_vectors.end(), IsValidVector) && - std::all_of(io_vectors.begin(), io_vectors.end(), IsValidVector); + return std::ranges::all_of(in_vectors, IsValidVector) && + std::ranges::all_of(io_vectors, IsValidVector); } void IOCtlRequest::Log(std::string_view device_name, Common::Log::LogType type, diff --git a/Source/Core/Core/IOS/ES/Formats.cpp b/Source/Core/Core/IOS/ES/Formats.cpp index 627560e765..80715f6a58 100644 --- a/Source/Core/Core/IOS/ES/Formats.cpp +++ b/Source/Core/Core/IOS/ES/Formats.cpp @@ -298,7 +298,7 @@ std::string TMDReader::GetGameID() const std::memcpy(game_id, m_bytes.data() + offsetof(TMDHeader, title_id) + 4, 4); std::memcpy(game_id + 4, m_bytes.data() + offsetof(TMDHeader, group_id), 2); - if (std::all_of(std::begin(game_id), std::end(game_id), Common::IsPrintableCharacter)) + if (std::ranges::all_of(game_id, Common::IsPrintableCharacter)) return std::string(game_id, sizeof(game_id)); return fmt::format("{:016x}", GetTitleId()); diff --git a/Source/Core/Core/IOS/ES/NandUtils.cpp b/Source/Core/Core/IOS/ES/NandUtils.cpp index b1ef7c8bd2..ad58d0806e 100644 --- a/Source/Core/Core/IOS/ES/NandUtils.cpp +++ b/Source/Core/Core/IOS/ES/NandUtils.cpp @@ -79,7 +79,7 @@ static bool IsValidPartOfTitleID(const std::string& string) { if (string.length() != 8) return false; - return std::all_of(string.begin(), string.end(), Common::IsXDigit); + return std::ranges::all_of(string, Common::IsXDigit); } static std::vector GetTitlesInTitleOrImport(FS::FileSystem* fs, const std::string& titles_dir) diff --git a/Source/Core/Core/IOS/ES/TitleManagement.cpp b/Source/Core/Core/IOS/ES/TitleManagement.cpp index df74acd766..e0d72af983 100644 --- a/Source/Core/Core/IOS/ES/TitleManagement.cpp +++ b/Source/Core/Core/IOS/ES/TitleManagement.cpp @@ -464,7 +464,7 @@ static bool HasAllRequiredContents(Kernel& ios, const ES::TMDReader& tmd) const u64 title_id = tmd.GetTitleId(); const std::vector contents = tmd.GetContents(); const ES::SharedContentMap shared_content_map{ios.GetFSCore()}; - return std::all_of(contents.cbegin(), contents.cend(), [&](const ES::Content& content) { + return std::ranges::all_of(contents, [&](const ES::Content& content) { if (content.IsOptional()) return true; diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp index 2d1e1143c9..f5c6794bc7 100644 --- a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp +++ b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp @@ -461,8 +461,7 @@ ResultCode HostFileSystem::Format(Uid uid) ResultCode HostFileSystem::CreateFileOrDirectory(Uid uid, Gid gid, const std::string& path, FileAttribute attr, Modes modes, bool is_file) { - if (!IsValidNonRootPath(path) || - !std::all_of(path.begin(), path.end(), Common::IsPrintableCharacter)) + if (!IsValidNonRootPath(path) || !std::ranges::all_of(path, Common::IsPrintableCharacter)) { return ResultCode::Invalid; } diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 7c64b5f008..cab393c37b 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -93,7 +93,7 @@ static std::array ConvertGitRevisionToBytes(const std::string& revision) { std::array revision_bytes{}; - if (revision.size() % 2 == 0 && std::all_of(revision.begin(), revision.end(), Common::IsXDigit)) + if (revision.size() % 2 == 0 && std::ranges::all_of(revision, Common::IsXDigit)) { // The revision string normally contains a git commit hash, // which is 40 hexadecimal digits long. In DTM files, each pair of diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 82c594dff6..14b43907ef 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -2543,7 +2543,7 @@ bool NetPlayClient::DoAllPlayersHaveGame() { std::lock_guard lkp(m_crit.players); - return std::all_of(std::begin(m_players), std::end(m_players), [](auto entry) { + return std::ranges::all_of(m_players, [](const auto& entry) { return entry.second.game_status == SyncIdentifierComparison::SameGame; }); } diff --git a/Source/Core/Core/NetPlayCommon.cpp b/Source/Core/Core/NetPlayCommon.cpp index c96586794b..52458c6259 100644 --- a/Source/Core/Core/NetPlayCommon.cpp +++ b/Source/Core/Core/NetPlayCommon.cpp @@ -237,7 +237,7 @@ static bool DecompressPacketIntoFolderInternal(sf::Packet& packet, const std::st if (name.find('\\') != std::string::npos) return false; #endif - if (std::all_of(name.begin(), name.end(), [](char c) { return c == '.'; })) + if (std::ranges::all_of(name, [](char c) { return c == '.'; })) return false; bool is_folder; diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index ae88ba3d82..0f53e8008f 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -1060,14 +1060,14 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) { // we have all records for this frame - if (!std::all_of(timebases.begin(), timebases.end(), [&](std::pair pair) { + if (!std::ranges::all_of(timebases, [&](std::pair pair) { return pair.second == timebases[0].second; })) { int pid_to_blame = 0; for (auto pair : timebases) { - if (std::all_of(timebases.begin(), timebases.end(), [&](std::pair other) { + if (std::ranges::all_of(timebases, [&](std::pair other) { return other.first == pair.first || other.second != pair.second; })) { @@ -1467,14 +1467,12 @@ bool NetPlayServer::SetupNetSettings() bool NetPlayServer::DoAllPlayersHaveIPLDump() const { - return std::all_of(m_players.begin(), m_players.end(), - [](const auto& p) { return p.second.has_ipl_dump; }); + return std::ranges::all_of(m_players, [](const auto& p) { return p.second.has_ipl_dump; }); } bool NetPlayServer::DoAllPlayersHaveHardwareFMA() const { - return std::all_of(m_players.begin(), m_players.end(), - [](const auto& p) { return p.second.has_hardware_fma; }); + return std::ranges::all_of(m_players, [](const auto& p) { return p.second.has_hardware_fma; }); } struct SaveSyncInfo diff --git a/Source/Core/DiscIO/DiscUtils.cpp b/Source/Core/DiscIO/DiscUtils.cpp index 5d03a5aa7f..8564e8c017 100644 --- a/Source/Core/DiscIO/DiscUtils.cpp +++ b/Source/Core/DiscIO/DiscUtils.cpp @@ -40,7 +40,7 @@ std::string NameForPartitionType(u32 partition_type, bool include_prefix) static_cast((partition_type >> 16) & 0xFF), static_cast((partition_type >> 8) & 0xFF), static_cast(partition_type & 0xFF)}; - if (std::all_of(type_as_game_id.cbegin(), type_as_game_id.cend(), Common::IsAlnum)) + if (std::ranges::all_of(type_as_game_id, Common::IsAlnum)) { return include_prefix ? "P-" + type_as_game_id : type_as_game_id; } diff --git a/Source/Core/DiscIO/RiivolutionPatcher.cpp b/Source/Core/DiscIO/RiivolutionPatcher.cpp index eff36077f9..9dce9e9a8f 100644 --- a/Source/Core/DiscIO/RiivolutionPatcher.cpp +++ b/Source/Core/DiscIO/RiivolutionPatcher.cpp @@ -104,7 +104,7 @@ FileDataLoaderHostFS::MakeAbsoluteFromRelative(std::string_view external_relativ result.pop_back(); result.pop_back(); } - else if (std::all_of(element.begin(), element.end(), [](char c) { return c == '.'; })) + else if (std::ranges::all_of(element, [](char c) { return c == '.'; })) { // This is a triple, quadruple, etc. dot. // Some file systems treat this as several 'up' path traversals, but Riivolution does not. diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index bc75e71b88..61848a4218 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -176,7 +176,7 @@ IOS::ES::TicketReader VolumeWAD::GetTicketWithFixedCommonKey() const return m_ticket; const std::vector sig = m_ticket.GetSignatureData(); - if (!std::all_of(sig.cbegin(), sig.cend(), [](u8 a) { return a == 0; })) + if (!std::ranges::all_of(sig, [](u8 a) { return a == 0; })) { // This does not look like a typical "invalid common key index" ticket, so let's assume // the index is correct. This saves some time when reading properly signed titles. diff --git a/Source/Core/DiscIO/WIABlob.cpp b/Source/Core/DiscIO/WIABlob.cpp index c0f3930899..ec39245884 100644 --- a/Source/Core/DiscIO/WIABlob.cpp +++ b/Source/Core/DiscIO/WIABlob.cpp @@ -1126,7 +1126,7 @@ bool WIARVZFileReader::TryReuse(std::map* reusable_gro static bool AllAre(const std::vector& data, u8 x) { - return std::all_of(data.begin(), data.end(), [x](u8 y) { return x == y; }); + return std::ranges::all_of(data, [x](u8 y) { return x == y; }); } static bool AllAre(const u8* begin, const u8* end, u8 x) @@ -1379,8 +1379,8 @@ WIARVZFileReader::ProcessAndCompress(CompressThreadState* state, CompressPa } } - if (!std::all_of(output_entries.begin(), output_entries.end(), - [](const OutputParametersEntry& entry) { return entry.reused_group; })) + if (!std::ranges::all_of(output_entries, + [](const auto& entry) { return entry.reused_group.has_value(); })) { const u64 number_of_exception_lists = chunks_per_wii_group == 1 ? exception_lists_per_chunk : chunks; diff --git a/Source/Core/DolphinQt/ConvertDialog.cpp b/Source/Core/DolphinQt/ConvertDialog.cpp index ee6229938c..e316eed9c1 100644 --- a/Source/Core/DolphinQt/ConvertDialog.cpp +++ b/Source/Core/DolphinQt/ConvertDialog.cpp @@ -52,8 +52,8 @@ ConvertDialog::ConvertDialog(QList> fi m_format->addItem(QStringLiteral("GCZ"), static_cast(DiscIO::BlobType::GCZ)); m_format->addItem(QStringLiteral("WIA"), static_cast(DiscIO::BlobType::WIA)); m_format->addItem(QStringLiteral("RVZ"), static_cast(DiscIO::BlobType::RVZ)); - if (std::all_of(m_files.begin(), m_files.end(), - [](const auto& file) { return file->GetBlobType() == DiscIO::BlobType::PLAIN; })) + if (std::ranges::all_of( + m_files, [](const auto& file) { return file->GetBlobType() == DiscIO::BlobType::PLAIN; })) { m_format->setCurrentIndex(m_format->count() - 1); } @@ -153,7 +153,7 @@ void ConvertDialog::OnFormatChanged() // To support legacy versions of dolphin, we have to check the GCZ block size // See DiscIO::IsGCZBlockSizeLegacyCompatible() for details const auto block_size_ok = [this](int block_size) { - return std::all_of(m_files.begin(), m_files.end(), [block_size](const auto& file) { + return std::ranges::all_of(m_files, [block_size](const auto& file) { return DiscIO::IsGCZBlockSizeLegacyCompatible(block_size, file->GetVolumeSize()); }); }; diff --git a/Source/Core/DolphinQt/GameList/GameList.cpp b/Source/Core/DolphinQt/GameList/GameList.cpp index 64e9ae6774..c3c5a984e4 100644 --- a/Source/Core/DolphinQt/GameList/GameList.cpp +++ b/Source/Core/DolphinQt/GameList/GameList.cpp @@ -377,15 +377,15 @@ void GameList::ShowContextMenu(const QPoint&) { const auto selected_games = GetSelectedGames(); - if (std::all_of(selected_games.begin(), selected_games.end(), - [](const auto& game) { return game->ShouldAllowConversion(); })) + if (std::ranges::all_of(selected_games, + [](const auto& game) { return game->ShouldAllowConversion(); })) { menu->addAction(tr("Convert Selected Files..."), this, &GameList::ConvertFile); menu->addSeparator(); } - if (std::all_of(selected_games.begin(), selected_games.end(), - [](const auto& game) { return DiscIO::IsWii(game->GetPlatform()); })) + if (std::ranges::all_of(selected_games, + [](const auto& game) { return DiscIO::IsWii(game->GetPlatform()); })) { menu->addAction(tr("Export Wii Saves"), this, &GameList::ExportWiiSave); menu->addSeparator(); diff --git a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp index 5ccb8b5bc9..cf159e0a16 100644 --- a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp +++ b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp @@ -30,7 +30,7 @@ static bool IsValidUSBIDString(const std::string& string) { if (string.empty() || string.length() > 4) return false; - return std::all_of(string.begin(), string.end(), Common::IsXDigit); + return std::ranges::all_of(string, Common::IsXDigit); } USBDeviceAddToWhitelistDialog::USBDeviceAddToWhitelistDialog(QWidget* parent) : QDialog(parent) diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp index b558d6b78f..dd897c2535 100644 --- a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp +++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp @@ -495,10 +495,8 @@ public: ControlState GetValue() const override { // True if we have no modifiers - const bool modifiers_pressed = std::all_of(m_modifiers.begin(), m_modifiers.end(), - [](const std::unique_ptr& input) { - return input->GetValue() > CONDITION_THRESHOLD; - }); + const bool modifiers_pressed = std::ranges::all_of( + m_modifiers, [](const auto& input) { return input->GetValue() > CONDITION_THRESHOLD; }); const auto final_input_state = m_final_input->GetValueIgnoringSuppression(); diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp index dfd282d533..d6cb4b95ff 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp @@ -25,8 +25,8 @@ IMUAccelerometer::IMUAccelerometer(std::string name_, std::string ui_name_) bool IMUAccelerometer::AreInputsBound() const { - return std::all_of(controls.begin(), controls.end(), - [](const auto& control) { return control->control_ref->BoundCount() > 0; }); + return std::ranges::all_of( + controls, [](const auto& control) { return control->control_ref->BoundCount() > 0; }); } std::optional IMUAccelerometer::GetState() const diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp index 2e8c4bb18c..0ad720dcdb 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp @@ -123,8 +123,8 @@ auto IMUGyroscope::GetRawState() const -> StateData bool IMUGyroscope::AreInputsBound() const { - return std::all_of(controls.begin(), controls.end(), - [](const auto& control) { return control->control_ref->BoundCount() > 0; }); + return std::ranges::all_of( + controls, [](const auto& control) { return control->control_ref->BoundCount() > 0; }); } bool IMUGyroscope::CanCalibrate() const diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp index 1877e8294c..fb9d43f22f 100644 --- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp +++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp @@ -44,7 +44,7 @@ std::string GetExpressionForControl(const std::string& control_name, { // If our expression contains any non-alpha characters // we should quote it - if (!std::all_of(expr.begin(), expr.end(), Common::IsAlpha)) + if (!std::ranges::all_of(expr, Common::IsAlpha)) expr = fmt::format("`{}`", expr); } diff --git a/Source/Core/InputCommon/DynamicInputTextures/DITSpecification.cpp b/Source/Core/InputCommon/DynamicInputTextures/DITSpecification.cpp index f5409b518f..70c4651a24 100644 --- a/Source/Core/InputCommon/DynamicInputTextures/DITSpecification.cpp +++ b/Source/Core/InputCommon/DynamicInputTextures/DITSpecification.cpp @@ -136,8 +136,7 @@ bool ProcessSpecificationV1(picojson::value& root, std::vector& input_text return false; } - if (!std::all_of(region_offsets.begin(), region_offsets.end(), - [](picojson::value val) { return val.is(); })) + if (!std::ranges::all_of(region_offsets, &picojson::value::is)) { ERROR_LOG_FMT( VIDEO, diff --git a/Source/Core/VideoCommon/Assets/MaterialAsset.cpp b/Source/Core/VideoCommon/Assets/MaterialAsset.cpp index 651ff589f4..a9f2940deb 100644 --- a/Source/Core/VideoCommon/Assets/MaterialAsset.cpp +++ b/Source/Core/VideoCommon/Assets/MaterialAsset.cpp @@ -63,8 +63,7 @@ bool ParseNumeric(const CustomAssetLibrary::AssetID& asset_id, const picojson::v return false; } - if (!std::all_of(json_data.begin(), json_data.end(), - [](const picojson::value& v) { return v.is(); })) + if (!std::ranges::all_of(json_data, &picojson::value::is)) { ERROR_LOG_FMT(VIDEO, "Asset id '{}' material has attribute '{}' where " diff --git a/Source/Core/VideoCommon/Assets/ShaderAsset.cpp b/Source/Core/VideoCommon/Assets/ShaderAsset.cpp index 88fc841d9b..dbe4c5cb02 100644 --- a/Source/Core/VideoCommon/Assets/ShaderAsset.cpp +++ b/Source/Core/VideoCommon/Assets/ShaderAsset.cpp @@ -54,8 +54,7 @@ bool ParseNumeric(const CustomAssetLibrary::AssetID& asset_id, const picojson::v return false; } - if (!std::all_of(json_data.begin(), json_data.end(), - [](const picojson::value& v) { return v.is(); })) + if (!std::ranges::all_of(json_data, &picojson::value::is)) { ERROR_LOG_FMT(VIDEO, "Asset id '{}' shader has attribute '{}' where "