From de3a1c0a402d62a7e1f18094524b24d4ab94a24e Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Thu, 8 Aug 2024 11:37:47 +0200 Subject: [PATCH] Remove std::ranges::views usage (doesn't work with Ubuntu20's stdlib) --- .../ModelWarper/ModelWarperConfiguration.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/OpenSimCreator/Documents/ModelWarper/ModelWarperConfiguration.cpp b/src/OpenSimCreator/Documents/ModelWarper/ModelWarperConfiguration.cpp index 72ae98ca20..c1027afd21 100644 --- a/src/OpenSimCreator/Documents/ModelWarper/ModelWarperConfiguration.cpp +++ b/src/OpenSimCreator/Documents/ModelWarper/ModelWarperConfiguration.cpp @@ -14,10 +14,10 @@ #include #include #include +#include using namespace osc::mow; namespace rgs = std::ranges; -namespace views = std::ranges::views; PairedPoints osc::mow::PairedPointSource::getPairedPoints( WarpCache& warpCache, @@ -27,13 +27,14 @@ PairedPoints osc::mow::PairedPointSource::getPairedPoints( // ensure no validation errors { const auto checks = validate(sourceModel, sourceComponent); - auto filtered = views::filter(checks, [](const auto& check) { return check.state() == ValidationCheckState::Error; }); - if (not filtered.empty()) { + auto it = rgs::find_if(checks, &ValidationCheckResult::is_error); + if (it != checks.end()) { std::stringstream ss; ss << getName() << ": validation errors detected:\n"; - for (const ValidationCheckResult& result : filtered) { - ss << " - " << result.description() << '\n'; - } + do { + ss << " - " << it->description() << '\n'; + it = rgs::find_if(it+1, checks.end(), &ValidationCheckResult::is_error); + } while (it != checks.end()); throw std::runtime_error{std::move(ss).str()}; } }