diff options
| author | Leitwolf11 | 2026-10-31 13:00:24 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-10-31 13:00:24 +0300 |
| commit | 8814bd0b796b2e291fa5b4a1033f0313c8a26065 (patch) | |
| tree | e87e5f5150f3712bb05ed53911425600aa871f45 /src/Progmasoft/Runner | |
| parent | 6a42cdf6461b2577106ef094d6f98025554b6077 (diff) | |
| download | catch3-8814bd0b796b2e291fa5b4a1033f0313c8a26065.tar.gz | |
Build Catch3 as C++17
C++17 is still the widest common target, and a library built on it stays
usable from C++17 and every later standard, while C++20 would have left
out many users.
Concepts become enable_if on named traits in Detail/TypeTraits.hpp, which
also replaces std::remove_cvref_t and std::identity. std::span becomes
std::vector references, std::bit_cast becomes static_cast and memcpy,
template lambdas become helper templates, and std::erase_if, contains,
starts_with and ends_with have their C++17 forms. Random::Between no
longer uses a lambda over a constexpr local, which MSVC rejects outside
/permissive-, so the headers work under its default mode too.
Tests give up designated initializers, which MSVC refuses in C++17. CI
builds the matrix in C++17 and C++20, since the headers promise both.
Diffstat (limited to 'src/Progmasoft/Runner')
| -rw-r--r-- | src/Progmasoft/Runner/Process.cpp | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/Progmasoft/Runner/Process.cpp b/src/Progmasoft/Runner/Process.cpp index 8ef02327..d0b5b512 100644 --- a/src/Progmasoft/Runner/Process.cpp +++ b/src/Progmasoft/Runner/Process.cpp @@ -191,18 +191,22 @@ namespace Progmasoft::Catch3::Runner for (const auto &[name, value] : additions) { const std::wstring wideName = Widen(name); - std::erase_if(entries, [&](const std::wstring &entry) { - // A leading '=' marks the hidden per-drive variables. - const auto equals = entry.find(L'=', 1); - return equals == wideName.size() - && CompareStringOrdinal( - entry.data(), - static_cast<int>(equals), - wideName.data(), - static_cast<int>(wideName.size()), - TRUE) - == CSTR_EQUAL; - }); + const auto removed = std::remove_if( + entries.begin(), + entries.end(), + [&](const std::wstring &entry) { + // A leading '=' marks the hidden per-drive variables. + const auto equals = entry.find(L'=', 1); + return equals == wideName.size() + && CompareStringOrdinal( + entry.data(), + static_cast<int>(equals), + wideName.data(), + static_cast<int>(wideName.size()), + TRUE) + == CSTR_EQUAL; + }); + entries.erase(removed, entries.end()); entries.push_back(wideName + L"=" + Widen(value)); } std::wstring block; @@ -957,11 +961,15 @@ namespace Progmasoft::Catch3::Runner } for (const auto &[name, value] : options.environment) { - std::erase_if(environmentStorage, [&](const std::string &entry) { - return entry.size() > name.size() - && entry.compare(0, name.size(), name) == 0 - && entry[name.size()] == '='; - }); + const auto removed = std::remove_if( + environmentStorage.begin(), + environmentStorage.end(), + [&](const std::string &entry) { + return entry.size() > name.size() + && entry.compare(0, name.size(), name) == 0 + && entry[name.size()] == '='; + }); + environmentStorage.erase(removed, environmentStorage.end()); environmentStorage.push_back(name + "=" + value); } std::vector<char *> environment; |